Skip to content

Commit

Permalink
docs: better usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
Contextualist committed Sep 5, 2023
1 parent d14c823 commit faceaa9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ Then run `acp --setup` to generate an identity.
# sender
acp path/to/files

# receiver
acp # for receiving to pwd or
acp -d path/to/dest
# receiver, to $(pwd)
acp
# or receive to/as specified target
acp -d path/to/target
```

You can run the sender and receiver in arbitrary order.
Expand Down
12 changes: 11 additions & 1 deletion cmd/acp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ import (
"github.com/contextualist/acp/pkg/tui"
)

const UsageBrief = `Usage:
# sender
acp path/to/files
# receiver, to $(pwd)
acp
# or receive to/as specified target
acp -d path/to/target
`

var buildTag string // build-time injected

var (
Expand All @@ -31,7 +41,7 @@ var exitStatement string

func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "%s (%s)\nUsage:\n", os.Args[0], buildTag)
fmt.Fprintf(flag.CommandLine.Output(), "%s (%s)\n%s\nOptions:\n", os.Args[0], buildTag, UsageBrief)
flag.PrintDefaults()
}
flag.Parse()
Expand Down

0 comments on commit faceaa9

Please sign in to comment.