common

package
v0.0.0-...-a216e23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package common provides implementation of general interest for certain sub packages of Inago.

Index

Examples

Constants

This section is empty.

Variables

View Source
var ExtExp = regexp.MustCompile(`(?m)\.[a-z]*$`)

ExtExp matches unit file extensions.

app@1.service  =>  .service
app@1.mount    =>  .mount
app.service    =>  .service
app.mount      =>  .mount

Functions

func SliceID

func SliceID(name string) (string, error)

SliceID takes a unit file name and returns its slice ID.

Example

ExampleSliceID is an example of the SliceID function.

for _, input := range []string{
	"app@1.service",
	"app@1.mount",
	"app.service",
	"app.mount",
} {
	id, _ := SliceID(input)
	fmt.Println(id)
}
Output:

1
1

func UnitBase

func UnitBase(name string) string

UnitBase returns the base of the unit name. The base is considered everything up to the @ character, if any, or the given name without extension.

Example

ExampleUnitBase is an example of the UnitBase function.

for _, input := range []string{
	"app@1.service",
	"app@1.mount",
	"app.service",
	"app.mount",
} {
	fmt.Println(UnitBase(input))
}
Output:

app
app
app
app

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL