Documentation
¶
Index ¶
- func Cleanup(ev Env) error
- func ConfigGet(cfg *env.Config, optionName string) error
- func ConfigGetAll(_ Env, cfg *env.Config) error
- func ConfigSet(ev Env, cfg *env.Config, optionName, optionValue string) error
- func ConfigUnset(ev Env, cfg *env.Config, optionName string) error
- func Dump(ev Env, bundleFile string) error
- func Get(ctx context.Context, ev Env, spec gordon.VersionSpec) error
- func InitLog()
- func Install(ctx context.Context, ev Env, spec gordon.VersionSpec) error
- func Restore(ctx context.Context, ev Env, bundle string) error
- func Setup(_ context.Context, ev Env) error
- func Uninstall(ctx context.Context, ev Env, spec gordon.AppSpec) error
- func Update(ctx context.Context, ev Env) error
- type Env
- type HubClient
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigGet ¶
Example ¶
package main import ( "log" "strings" "github.com/kyoh86/gogh/command" "github.com/kyoh86/gogh/env" ) func main() { yml := strings.NewReader(`{"roots": ["/foo", "/bar"]}`) config, err := env.GetConfig(yml) if err != nil { log.Fatalln(err) } if err := command.ConfigGet(&config, "roots"); err != nil { log.Fatalln(err) } }
Output: /foo:/bar
func ConfigGetAll ¶
Example ¶
package main import ( "log" "strings" "github.com/kyoh86/gogh/command" "github.com/kyoh86/gogh/env" ) func main() { yml := strings.NewReader(` roots: - /root1 - /root2 hooks: - /hook1 - /hook2 githubHost: hostx1 githubUser: userx1`) config, err := env.GetConfig(yml) if err != nil { log.Fatalln(err) } if err := command.ConfigGetAll(&config); err != nil { log.Fatalln(err) } }
Output: roots: /root1:/root2 hooks: /hook1:/hook2 github.host: hostx1 github.user: userx1 github.token: *****
func ConfigSet ¶ added in v0.0.4
Example ¶
package main import ( "log" "os" "strings" "github.com/kyoh86/gogh/command" "github.com/kyoh86/gogh/env" ) func main() { source := strings.NewReader(` roots: - /root1 hooks: - /hook1 githubUser: userx1 githubHost: hostx1`) config, access, err := env.GetAppenv(source, env.EnvarPrefix) if err != nil { log.Fatalln(err) } if err := command.ConfigSet(&access, &config, "github.host", "hostx2"); err != nil { log.Fatalln(err) } if err := config.Save(os.Stdout); err != nil { log.Fatalln(err) } if err := command.ConfigGetAll(&config); err != nil { log.Fatalln(err) } }
Output: roots: - /root1 hooks: - /hook1 githubHost: hostx2 githubUser: userx1 roots: /root1 hooks: /hook1 github.host: hostx2 github.user: userx1 github.token: *****
func ConfigUnset ¶
Example ¶
package main import ( "log" "os" "strings" "github.com/kyoh86/gogh/command" "github.com/kyoh86/gogh/env" ) func main() { source := strings.NewReader(` roots: - /root1 hooks: - /hook1 githubUser: userx1 githubHost: hostx1`) config, access, err := env.GetAppenv(source, env.EnvarPrefix) if err != nil { log.Fatalln(err) } if err := command.ConfigUnset(&access, &config, "github.host"); err != nil { log.Fatalln(err) } if err := config.Save(os.Stdout); err != nil { log.Fatalln(err) } if err := command.ConfigGetAll(&config); err != nil { log.Fatalln(err) } }
Output: roots: - /root1 hooks: - /hook1 githubUser: userx1 roots: /root1 hooks: /hook1 github.host: github.user: userx1 github.token: *****
Types ¶
type Env ¶ added in v0.0.4
type Env interface { Architecture() string Bin() string Cache() string GithubHost() string GithubUser() string Hooks() []string Man() string OS() string }
Env is an interface generated for "github.com/kyoh86/gordon/internal/env.Access".
type HubClient ¶ added in v0.0.4
type HubClient interface { Asset(context.Context, *gogh.Repo, int64) (io.ReadCloser, error) LatestRelease(context.Context, *gogh.Repo) (*github.RepositoryRelease, error) Release(context.Context, *gogh.Repo, string) (*github.RepositoryRelease, error) }
HubClient is an interface generated for "github.com/kyoh86/gordon/internal/hub.Client".
Click to show internal directories.
Click to hide internal directories.