Documentation
¶
Index ¶
- Variables
- func Execute()
- func ExecuteAdd(cmdCfg *AddCommandConfig, appCtx *appcontext.Context) error
- func ExecuteDeploy(cmdCfg *DeployCommandConfig, appCtx *appcontext.Context) error
- func ExecuteInit(cmdCfg *InitCommandConfig) error
- func ExecuteRemove(cmdCfg *RemoveCommandConfig, appCtx *appcontext.Context) error
- func ExecuteStatus(appCtx *appcontext.Context, cmdCfg *StatusCommandConfig) error
- type AddCommandConfig
- type DeployCommandConfig
- type InitCommandConfig
- type RemoveCommandConfig
- type StatusCommandConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCommand cli.Command = cli.Command{ Name: "add", Aliases: []string{"a"}, Usage: "add a module to the peridot dotfiles directory", ArgsUsage: "<module>", Description: addCommandDescription, Arguments: []cli.Argument{ &cli.StringArg{ Name: "moduleName", Value: "", }, }, MutuallyExclusiveFlags: []cli.MutuallyExclusiveFlags{ { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Value: false, Usage: "show verbose debug info", }, }, { &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Value: false, Usage: "supress most logging output", }, }, }, }, }, Action: func(ctx context.Context, c *cli.Command) error { appCtx := appcontext.New() cmdCfg := &AddCommandConfig{ ModuleName: filepath.Clean(c.StringArg("moduleName")), Verbose: c.Bool("verbose"), Quiet: c.Bool("quiet"), } return ExecuteAdd(cmdCfg, appCtx) }, }
View Source
var DeployCommand cli.Command = cli.Command{ Name: "deploy", Aliases: []string{"d"}, Usage: "create dir/file symlinks from filesystem to module dir", ArgsUsage: "<module>", Description: deployCommandDescription, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "simulate", Aliases: []string{"s"}, Value: false, Usage: "don't make any changes, merely show what would be done", }, &cli.BoolFlag{ Name: "dotreplace", Aliases: []string{"D"}, Value: false, Usage: "rename both the intermediate file and the symlink to the deployed\n" + "files, from dot-* to .*", }, &cli.StringFlag{ Name: "root", Aliases: []string{"r"}, Value: "", Usage: "specify the root path to which the module dir's structure should\n" + "be deployed", TakesFile: true, }, }, MutuallyExclusiveFlags: []cli.MutuallyExclusiveFlags{ { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "overwrite", Aliases: []string{"O"}, Value: false, Usage: "forcefully replaces existing files in the filesystem by removing\n" + "them and creating the symlink", }, }, { &cli.BoolFlag{ Name: "adopt", Aliases: []string{"a"}, Value: false, Usage: "Imports existing files by copying their contents into the module,\n" + "then removes the originals and replaces them with symlinks", }, }, }, }, { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Value: false, Usage: "show verbose debug info", }, }, { &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Value: false, Usage: "supress most logging output", }, }, }, }, }, Arguments: []cli.Argument{ &cli.StringArg{ Name: "moduleName", Value: "", }, }, Action: func(ctx context.Context, c *cli.Command) error { appCtx := appcontext.New() cmdCfg := &DeployCommandConfig{ Simulate: c.Bool("simulate"), Overwrite: c.Bool("overwrite"), Adopt: c.Bool("adopt"), Dotreplace: c.Bool("dotreplace"), Root: c.String("root"), ModuleName: filepath.Clean(c.StringArg("moduleName")), Verbose: c.Bool("verbose"), Quiet: c.Bool("quiet"), } return ExecuteDeploy(cmdCfg, appCtx) }, }
View Source
var InitCommand cli.Command = cli.Command{ Name: "init", Aliases: []string{"i"}, Usage: "initialize dotfiles dir", Description: initCommandDescription, MutuallyExclusiveFlags: []cli.MutuallyExclusiveFlags{ { Required: false, Flags: [][]cli.Flag{ { &cli.StringFlag{ Name: "dir", Aliases: []string{"d"}, Value: "", Usage: "path of the dir to be initialized", }, }, { &cli.BoolFlag{ Name: "here", Aliases: []string{"H"}, Value: false, Usage: "set the dir to be initialized to the current dir", }, }, }, }, { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Value: false, Usage: "show verbose debug info", }, }, { &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Value: false, Usage: "supress most logging output", }, }, }, }, }, Action: func(ctx context.Context, c *cli.Command) error { cwd, err := os.Getwd() if err != nil { return fmt.Errorf("could not initialize dotfiles_dir: %w", err) } var initDir string if c.Bool("here") { initDir = cwd } else if c.String("dir") != "" { initDir, err = paths.ResolvePath(c.String("dir"), cwd) if err != nil { return fmt.Errorf("could not resolve path specified by the --dir flag: %w", err) } } else if val, exists := os.LookupEnv(paths.DotfilesDirEnvName); exists { initDir = val } else { initDir = cwd } cmdCfg := &InitCommandConfig{ InitDir: initDir, Verbose: c.Bool("verbose"), Quiet: c.Bool("quiet"), } return ExecuteInit(cmdCfg) }, }
View Source
var RemoveCommand cli.Command = cli.Command{ Name: "remove", Aliases: []string{"r"}, Usage: "remove a module from the dotfiles directory", ArgsUsage: "<module>", Description: removeCommandDescription, Arguments: []cli.Argument{ &cli.StringArg{ Name: "moduleName", Value: "", }, }, MutuallyExclusiveFlags: []cli.MutuallyExclusiveFlags{ { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Value: false, Usage: "show verbose debug info", }, }, { &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Value: false, Usage: "supress most logging output", }, }, }, }, }, Action: func(ctx context.Context, c *cli.Command) error { appCtx := appcontext.New() cmdCfg := &RemoveCommandConfig{ ModuleName: filepath.Clean(c.StringArg("moduleName")), Verbose: c.Bool("verbose"), Quiet: c.Bool("quiet"), } return ExecuteRemove(cmdCfg, appCtx) }, }
View Source
var StatusCommand cli.Command = cli.Command{ Name: "status", Aliases: []string{"s"}, Usage: "display the current state of the dotfiles dir", Description: statusCommandDescription, ArgsUsage: "[module]", Arguments: []cli.Argument{ &cli.StringArg{ Name: "moduleName", Value: "", }, }, MutuallyExclusiveFlags: []cli.MutuallyExclusiveFlags{ { Required: false, Flags: [][]cli.Flag{ { &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Value: false, Usage: "show verbose debug info", }, }, { &cli.BoolFlag{ Name: "quiet", Aliases: []string{"q"}, Value: false, Usage: "supress most logging output", }, }, }, }, }, Action: func(ctx context.Context, c *cli.Command) error { appCtx := appcontext.New() cmdCfg := &StatusCommandConfig{ Verbose: c.Bool("verbose"), Quiet: c.Bool("quiet"), } return ExecuteStatus(appCtx, cmdCfg) }, }
Functions ¶
func ExecuteAdd ¶
func ExecuteAdd(cmdCfg *AddCommandConfig, appCtx *appcontext.Context) error
func ExecuteDeploy ¶
func ExecuteDeploy(cmdCfg *DeployCommandConfig, appCtx *appcontext.Context) error
func ExecuteInit ¶
func ExecuteInit(cmdCfg *InitCommandConfig) error
func ExecuteRemove ¶
func ExecuteRemove(cmdCfg *RemoveCommandConfig, appCtx *appcontext.Context) error
func ExecuteStatus ¶
func ExecuteStatus(appCtx *appcontext.Context, cmdCfg *StatusCommandConfig) error
Types ¶
type AddCommandConfig ¶
type DeployCommandConfig ¶
type InitCommandConfig ¶
type RemoveCommandConfig ¶
type StatusCommandConfig ¶
Click to show internal directories.
Click to hide internal directories.