Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help tweaks #166

Merged
merged 3 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var addCommand = &cobra.Command{
Use: "add",
Use: "add targets...",
Args: cobra.MinimumNArgs(1),
Short: "Add an existing file, directory, or symlink to the source state",
RunE: makeRunE(config.runAddCommand),
Expand Down
2 changes: 1 addition & 1 deletion cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var applyCommand = &cobra.Command{
Use: "apply",
Use: "apply [targets...]",
Short: "Update the destination directory to match the target state",
RunE: makeRunE(config.runApplyCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/twpayne/go-vfs"
vfs "github.com/twpayne/go-vfs"
)

var archiveCommand = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var catCommand = &cobra.Command{
Use: "cat",
Use: "cat targets...",
Args: cobra.MinimumNArgs(1),
Short: "Write the target state of a file or symlink to stdout",
RunE: makeRunE(config.runCatCommand),
Expand Down
2 changes: 1 addition & 1 deletion cmd/chattr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

var chattrCommand = &cobra.Command{
Use: "chattr",
Use: "chattr attributes targets...",
Args: cobra.MinimumNArgs(2),
Short: "Change the attributes of a target in the source state",
RunE: makeRunE(config.runChattrCommand),
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Config struct {
configFile string
SourceDir string
DestDir string
Umask octalIntValue
Umask permValue
DryRun bool
Verbose bool
SourceVCSCommand string
Expand Down
2 changes: 1 addition & 1 deletion cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var diffCommand = &cobra.Command{
Use: "diff",
Use: "diff [targets...]",
Short: "Write the diff between the target state and the destination state to stdout",
RunE: makeRunE(config.runDiffCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type dumpCommandConfig struct {
}

var dumpCommand = &cobra.Command{
Use: "dump",
Use: "dump [targets...]",
Short: "Write a dump of the target state to stdout",
RunE: makeRunE(config.runDumpCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var editCommand = &cobra.Command{
Use: "edit",
Use: "edit targets...",
Args: cobra.MinimumNArgs(1),
Short: "Edit the source state of a target",
RunE: makeRunE(config.runEditCommand),
Expand Down
2 changes: 1 addition & 1 deletion cmd/forget.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var forgetCommand = &cobra.Command{
Use: "forget",
Use: "forget targets...",
Args: cobra.MinimumNArgs(1),
Short: "Remove a target from the source state",
RunE: makeRunE(config.runForgetCommand),
Expand Down
2 changes: 1 addition & 1 deletion cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

var _importCommand = &cobra.Command{
Use: "import",
Use: "import [filename]",
Args: cobra.MaximumNArgs(1),
Short: "Import a tar archive into the source state",
RunE: makeRunE(config.runImportCommand),
Expand Down
21 changes: 0 additions & 21 deletions cmd/octal_int_value.go

This file was deleted.

24 changes: 24 additions & 0 deletions cmd/perm_value.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"fmt"
"strconv"
)

// An permValue is an int that is scanned and printed in octal. It implements
// the pflag.Value interface for use as a command line flag.
type permValue int

func (p *permValue) Set(s string) error {
v, err := strconv.ParseInt(s, 8, 64)
*p = permValue(v)
return err
}

func (p *permValue) String() string {
return fmt.Sprintf("%03o", *p)
}

func (p *permValue) Type() string {
return "int"
}
2 changes: 1 addition & 1 deletion cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var removeCommand = &cobra.Command{
Use: "remove",
Use: "remove targets...",
Aliases: []string{"rm"},
Args: cobra.MinimumNArgs(1),
Short: "Remove a target from the source state and the destination directory",
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var (
config = Config{
Umask: octalIntValue(getUmask()),
Umask: permValue(getUmask()),
SourceVCSCommand: "git",
}
version = "dev"
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_bitwarden.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var bitwardenCommand = &cobra.Command{
Use: "bitwarden",
Use: "bitwarden [args...]",
Short: "Execute the Bitwarden CLI (bw)",
RunE: makeRunE(config.runBitwardenCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var genericSecretCommand = &cobra.Command{
Use: "generic",
Use: "generic [args...]",
Short: "Execute a generic secret command",
RunE: makeRunE(config.runGenericSecretCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_lastpass.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

var lastpassCommand = &cobra.Command{
Use: "lastpass",
Use: "lastpass [args...]",
Short: "Execute the LastPass CLI (lpass)",
RunE: makeRunE(config.runLastPassCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_onepassword.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var onepasswordCommand = &cobra.Command{
Use: "onepassword",
Use: "onepassword [args...]",
Short: "Execute the 1Password CLI (op)",
RunE: makeRunE(config.runOnePasswordCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_pass.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var passCommand = &cobra.Command{
Use: "pass",
Use: "pass [args...]",
Short: "Execute the pass CLI",
RunE: makeRunE(config.runPassCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/secret_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var vaultCommand = &cobra.Command{
Use: "vault",
Use: "vault [args...]",
Short: "Execute the Hashicorp Vault CLI (vault)",
RunE: makeRunE(config.runVaultCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var sourceCommand = &cobra.Command{
Use: "source",
Use: "source [args...]",
Short: "Run the source version control system command in the source directory",
RunE: makeRunE(config.runSourceCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/source_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var sourcePathCommand = &cobra.Command{
Use: "source-path",
Use: "source-path [targets...]",
Short: "Print the path of a target in the source state",
RunE: makeRunE(config.runSourcePathCommand),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var verifyCommand = &cobra.Command{
Use: "verify",
Use: "verify [targets...]",
Short: "Exit with success if the destination state matches the target state, fail otherwise",
RunE: makeRunE(config.runVerifyCommand),
}
Expand Down