diff options
Diffstat (limited to 'commands/patch')
-rw-r--r-- | commands/patch/init.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/commands/patch/init.go b/commands/patch/init.go new file mode 100644 index 00000000..328fcd9f --- /dev/null +++ b/commands/patch/init.go @@ -0,0 +1,36 @@ +package patch + +import ( + "fmt" + "os" + "path/filepath" + + "git.sr.ht/~rjarry/aerc/lib/pama" +) + +type Init struct { + Force bool `opt:"-f"` + Name string `opt:"name" required:"false"` +} + +func init() { + register(Init{}) +} + +func (Init) Aliases() []string { + return []string{"init"} +} + +func (i Init) Execute(args []string) error { + cwd, err := os.Getwd() + if err != nil { + return fmt.Errorf("Could not get current directory: %w", err) + } + + name := i.Name + if name == "" { + name = filepath.Base(cwd) + } + + return pama.New().Init(name, cwd, i.Force) +} |