plakar icon indicating copy to clipboard operation
plakar copied to clipboard

backup: add GNU-style long options for flags

Open lcheylus opened this issue 6 months ago • 10 comments

For backup subcommand, use GNU-style long options and one-letter shorthands for flags using github.com/spf13/pflag package.

  • Sync manpage and Markdown doc for backup subcommand
  • Fix test with --exclude in subcommands/backup/backup_test.go

Tests OK for backup subcommand

$ go test -v github.com/PlakarKorp/plakar/subcommands/backup
=== RUN   TestExecuteCmdCreateDefault
--- PASS: TestExecuteCmdCreateDefault (0.13s)
=== RUN   TestExecuteCmdCreateDefaultWithExcludes
--- PASS: TestExecuteCmdCreateDefaultWithExcludes (0.14s)
PASS
ok      github.com/PlakarKorp/plakar/subcommands/backup 0.281s

backup subcommand help with -h / --help flag (disable sorting of flags):

$ ./plakar at <PATH> backup -h
Usage: backup [OPTIONS] path
       backup [OPTIONS] @LOCATION

OPTIONS:
  -x, --exclude strings       glob pattern to exclude files, can be specified multiple times to add several exclusion patterns
      --exclude-file string   path to a file containing newline-separated regex patterns, treated as --exclude
  -t, --tag strings           comma-separated list of tags to apply to the snapshot
  -n, --scan                  do not actually perform a backup, just list the files
  -q, --quiet                 suppress output
  -s, --silent                suppress ALL output
  -c, --check                 check the snapshot after creating it
      --concurrency uint      maximum number of parallel tasks (default 57)
  -o, --option option=value   specify extra importer options
      --stdio                 output one line per file to stdout instead of the default interactive output
  -h, --help                  show this help message

Run 'plakar help backup' for details.

lcheylus avatar Jul 11 '25 09:07 lcheylus