context

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryPath

func BinaryPath() string

BinaryPath returns path of docker binary directory.

Example
package main

import (
	"fmt"

	"github.com/k-kinzal/aliases/pkg/aliases/context"
)

func main() {
	if err := context.ChangeHomePath("/tmp"); err != nil {
		panic(err)
	}
	fmt.Println(context.BinaryPath())
}
Output:

/tmp/docker

func ChangeConfPath

func ChangeConfPath(path string) error

ChangeConfPath changes configuration file path for aliases.

func ChangeExportPath

func ChangeExportPath(path string) error

ChangeExportPath changes export directory path for aliases.

func ChangeHomePath

func ChangeHomePath(path string) error

ChangeHomePath changes home directory path for aliases.

func ConfPath

func ConfPath() string

ConfPath returns path of configuration file.

Example
package main

import (
	"fmt"
	"os"

	"github.com/k-kinzal/aliases/pkg/aliases/context"
)

func main() {
	file, err := os.Create("/tmp/aliases.yaml")
	if err != nil {
		panic(err)
	}
	defer file.Close()

	if err := context.ChangeConfPath(file.Name()); err != nil {
		panic(err)
	}
	fmt.Println(context.ConfPath())
}
Output:

/tmp/aliases.yaml

func ExportPath

func ExportPath() string

ConfPath returns path of export directory.

Example
package main

import (
	"fmt"

	"github.com/k-kinzal/aliases/pkg/aliases/context"
)

func main() {
	if err := context.ChangeExportPath("/tmp/export"); err != nil {
		panic(err)
	}
	fmt.Println(context.ExportPath())
}
Output:

/tmp/export

func HomePath

func HomePath() string

HomePath returns home directory path for aliases.

Example
package main

import (
	"fmt"

	"github.com/k-kinzal/aliases/pkg/aliases/context"
)

func main() {
	if err := context.ChangeHomePath("/tmp"); err != nil {
		panic(err)
	}
	fmt.Println(context.HomePath())
}
Output:

/tmp

func TemporaryPath added in v0.5.0

func TemporaryPath() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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