command

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigGet

func ConfigGet(cfg *context.Config, optionName string) error
Example
package main

import (
	"github.com/kyoh86/gordon/internal/command"
	"github.com/kyoh86/gordon/internal/context"
)

func main() {
	if err := command.ConfigGet(&context.Config{
		VRoot: "/foo",
	}, "root"); err != nil {
		panic(err)
	}
}
Output:

/foo

func ConfigGetAll

func ConfigGetAll(cfg *context.Config) error
Example
package main

import (
	"github.com/kyoh86/gordon/internal/command"
	"github.com/kyoh86/gordon/internal/context"
)

func main() {
	if err := command.ConfigGetAll(&context.Config{
		GitHub: context.GitHubConfig{
			Token: "tokenx1",
			Host:  "hostx1",
			User:  "kyoh86",
		},
		Log: context.LogConfig{
			Level:        "trace",
			Date:         context.TrueOption,
			Time:         context.FalseOption,
			MicroSeconds: context.TrueOption,
			LongFile:     context.TrueOption,
			ShortFile:    context.TrueOption,
			UTC:          context.TrueOption,
		},
		History: context.HistoryConfig{
			File: "/var/log/gordon/history",
			Save: context.TrueOption,
		},
		Extract: context.ExtractConfig{
			Modes:   []context.FileMode{0111},
			Exclude: "exclude",
			Include: "include",
		},
		VRoot:         "/foo",
		VArchitecture: "arch",
		VOS:           "os",
	}); err != nil {
		panic(err)
	}
}
Output:

log.level: trace
log.date: yes
log.time: no
log.microseconds: yes
log.longfile: yes
log.shortfile: yes
log.utc: yes
github.host: hostx1
github.user: kyoh86
github.token: *****
history.file: /var/log/gordon/history
history.save: yes
extract.modes: 0111
extract.exclude: exclude
extract.include: include
root: /foo
architecture: arch
os: os

func ConfigPrompt

func ConfigPrompt(cfg *context.Config) error

func ConfigPut

func ConfigPut(cfg *context.Config, optionName, optionValue string) error

func ConfigUnset

func ConfigUnset(cfg *context.Config, optionName string) error

func Download

func Download(ctx context.Context, repo *gogh.Repo, tag string) error

Download a package from GitHub Release. If `tag` is empty, it will download from the latest release.

Types

This section is empty.

Jump to

Keyboard shortcuts

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