Skip to content

Commit

Permalink
Remove docopt dependency: not really needed, poor messages, can't do …
Browse files Browse the repository at this point in the history
…cp-style repeated args

docopt/docopt.go#5
  • Loading branch information
sourcefrog committed Jan 26, 2014
1 parent 7320d8e commit be6e985
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ of installation:

sudo apt-get install --no-install-recommends `cat debian_dependencies`

Conserve (specifically the docopt dependency) needs Go 1.1, which is only in
Debian Jessie and later.

To run the tests, [cram](https://pypi.python.org/pypi/cram) is needed:

pip install cram
Expand Down
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
* Maybe move back away from docopt: poor errors; can't handle non-final repeated arguments.
* Set stamp on archive and band headers.

* Validate names are clean
Expand Down
18 changes: 10 additions & 8 deletions cli/conserve/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Conserve - robust backup system
// Copyright 2012-2013 Martin Pool
// Copyright 2012-2014 Martin Pool
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
Expand All @@ -14,12 +14,12 @@
package main

import (
"github.com/docopt/docopt.go"
"flag"
"fmt"
"github.com/sourcefrog/conserve"
)

const usage = `
conserve - a robust backup program
const usage = `conserve - a robust backup program
Copyright 2012-2013 Martin Pool
Licenced under the GNU General Public Licence, version 2 or later.
Expand All @@ -40,10 +40,12 @@ Options:
// conserve validate <archive>

func main() {
args, _ := docopt.Parse(usage, nil, true,
conserve.ConserveVersion, false)
flag.Parse()
cmd := flag.Arg(0)

if args["init"].(bool) {
conserve.InitArchive(args["<dir>"].(string))
if flag.NArg() == 0 {
fmt.Print(usage)
} else if cmd == "init" {
conserve.InitArchive(flag.Arg(1))
}
}
12 changes: 11 additions & 1 deletion tests/hello.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
Everything in Conserve is done through a subcommand to the `conserve` command:

$ conserve
conserve - a robust backup program

Copyright 2012-2013 Martin Pool
Licenced under the GNU General Public Licence, version 2 or later.
Conserve comes with ABSOLUTELY NO WARRANTY of any kind.

Usage:
conserve [-v] init <dir>
[1]

Options:
--help Show help.
--version Show version.
-v Be more verbose.

All log output has a prefix which includes the message severity (E=error,
I=info, etc); the MMDD date; the time; the PID; and the source location.
Expand Down

0 comments on commit be6e985

Please sign in to comment.