summaryrefslogtreecommitdiff
path: root/memex/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'memex/main.go')
-rw-r--r--memex/main.go14
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 {