diff options
| author | Quentin Carbonneaux | 2023-06-23 10:31:57 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux | 2023-06-23 10:31:57 +0200 |
| commit | acf8a15c23c2b46d79b88389e0a4d431495db19e (patch) | |
| tree | afff3bc2e1b2bcbaff39eb7253b12cffa9c7fa25 | |
| parent | d1d7495d202d2a8d5c981911cb99dce947c14c11 (diff) | |
[mx] document the init command
| -rw-r--r-- | memex/main.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/memex/main.go b/memex/main.go index 128cf74..79e7953 100644 --- a/memex/main.go +++ b/memex/main.go @@ -741,8 +741,8 @@ func syncCmd(args syncArgs) { } } -func initCmd(args []string) { - for _, p := range args { +func initCmd(paths []string) { + for _, p := range paths { if err := InitArchive(p); err != nil { faile(err) } else { @@ -1047,6 +1047,10 @@ func resetCmd(args resetArgs) { type UsageAlt struct{ args, desc string } var docs = map[string][]UsageAlt{ + "init": {{ + "[PATH ...]", + `Sets up new bare archives at the specified paths`, + }}, "commit": {{ "[-f] [-m MESSAGE] [PATH ...]", `Commits the filesystem objects listed; if the list @@ -1178,10 +1182,14 @@ func main() { } if os.Args[1] == "init" { - initCmd(os.Args[2:]) + cmd := flag.NewFlagSet("init", flag.ContinueOnError) + parseArgs("init", cmd) + initCmd(cmd.Args()) os.Exit(0) } + /* all commands but init have to be run + * from within a memex checkout */ dir, _ := os.Getwd() cur, err := ParseConfig(dir, &config) if err != nil { |
