Commit graph

5 commits

Author SHA1 Message Date
Dan Anglin 4f90a4c8bb
fix: use default FlagSet for spruce help message
Use the default FlagSet to parse all the arguments and to set the
default help message for spruce. Arguments set after the subcommand are
still parsed by the subcommand's FlagSet.

The summaries for all subcommand are defined in one place in the main
function for consistency.

The internal/cmd.SpruceUsage function is replaced with the
spruceUsageFunc function in the main package which returns the usage
function which is set as the default usage function.

The format of the help message for spruce and the subcommands have been
updated with the inspiration of the help message from gopass.
2023-08-20 06:14:10 +01:00
Dan Anglin c53978cd91
feat: add a field for location type, code refactor
- feat: add a field for the type of work location (e.g. hybrid)
- refactor: move the Tex and PDF generating code to a new internal
  package which also moves the templates there as well.
- fix: add a default value for the --output field for the generate
  command.
- fix: add an error for when the user does not specify an input file
  when generating the PDF.
- fix: the package name for each of the files in the templateFuncs
  package.
2023-08-15 17:25:00 +01:00
Dan Anglin 90638f5569
fix: customised usage messages
Add functionality to display the default help message when running
spruce without any arguments or when the help flag is used.

Customise the help message for the subcommands.

Additional changes:

- Refactor: move the Runner interface to the internal cmd package
- Fix: Add a summary for each of the subcommands.
- Refactor: Use string builder to replace string literals.
- Perf: Use a switch statement to only create the subcommand that the
  user calls.
2023-08-13 17:45:33 +01:00
Dan Anglin 2a6cc07624
fix: use slog for logging
- Created a new slog logger for logging.
- Optionally enable verbose logging when generating the PDF document.
2023-08-12 12:02:44 +01:00
Dan Anglin 2c5c7332be
refactor: move the subcommands to internal
Move the subcommands and FlagSets to a new internal package.
2023-08-12 10:26:23 +01:00
Renamed from generate.go (Browse further)