Commit graph

34 commits

Author SHA1 Message Date
Dan Anglin b2ce85b146
ci(fix): update environment variables
All checks were successful
/ test (pull_request) Successful in 25s
/ lint (pull_request) Successful in 25s
2023-12-06 14:48:20 +00:00
Dan Anglin 649f074d25
Update Project
All checks were successful
/ test (pull_request) Successful in 26s
/ lint (pull_request) Successful in 26s
Changes:

- ci: Add a workflow for Forgejo Actions
- docs: Update README.asciidoc
- tests: add a mage target for running tests
2023-12-06 14:42:18 +00:00
Dan Anglin 71d62ecaf6
refactor: add golangci-lint with code refactoring
Add golangci-lint for linting and refactor the code based on the
feedback from running it.

Changes:

- Add configuration for golangci-lint.
- Break the large function in create.go into smaller ones.
- Rename internal/templateFuncs to internal/templatefuncs to remove
  upper case letters in the package name.
- Add a mage target for lint tests.
2023-08-21 03:07:06 +01:00
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 8a530551c2
fix: create separate types for work and education
Create separate types for education and employment to fix the issue
where unnecessary fields are created under both education and employment
when a new CV is created.
2023-08-19 00:29:55 +01:00
Dan Anglin 9e0f5af2e6
fix: use JSON schema to auto-generate the CV type
- Use go generate and a third party tool called jsonschemagen to
  auto-generate the CV data type from the JSON schema.
- Update the schema by changing number to integer to ensure that the
  integers are set to the correct type.
- Refactor some code.
2023-08-18 23:47:41 +01:00
Dan Anglin 831e91a45d
fix: improve spruce-docgen
Improve spruce-docgen by improving how additionalProperties is
unmarshalled. If the value is either true or false then
AdditionalProperties is set to the default schema value.

Update getType to return discovered maps.

Update refType to return UNKNOWN if the ref string is invalid.

Regenerated docs/schema.asciidoc
2023-08-18 15:13:17 +01:00
Dan Anglin 446691719f
small bit of refactoring; refType validate ref string 2023-08-18 14:21:36 +01:00
Dan Anglin 1877f23a6e
docs: add section on creating CVs 2023-08-18 14:11:52 +01:00
Dan Anglin b92ab4e437
feat: add JSON schema and document generator
Add the schema for the CV JSON documentation and add an internal tool
called spruce-docgen that generates an AsciiDoc referencing the schema.
2023-08-17 21:51:53 +01:00
Dan Anglin d0d03f48b7
chore: move main.go to cmd/spruce
In preparation for additional binaries that may or may
not appear.
2023-08-16 23:33:28 +01:00
Dan Anglin 93da4f6648
fix: docker support improvements
- Build the binary with Mage.
- Set the ENTRYPOINT to "spruce".
- Add instructions on building and using the docker image.
2023-08-16 03:33:13 +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 050748d8cd
docs: replace local links with full URLs 2023-08-12 15:33:18 +01:00
Dan Anglin 82bdc231e3
docs: update README
- Convert README.md to README.asciidoc
- Update the requirements section
- Add installation section
2023-08-12 15:26:04 +01:00
Dan Anglin 2739e2fd28
build: fix the copying of the binary 2023-08-12 14:08:50 +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
Dan Anglin 54d5fa1831
Merge branch 'create-subcommand' 2023-08-12 09:51:35 +01:00
Dan Anglin 36acb1a324
feat: add create subcommand and FlagSet
- Add a new subcommand and FlagSet for creating new CV JSON files.
- fix: close the file after reading the CV.
2023-08-12 09:43:45 +01:00
Dan Anglin 2c57c3c278
build(clean): list files to remove
Add a list of files to remove when cleaning the workspace.
2023-08-11 19:31:26 +01:00
Dan Anglin b9dbdb2c61
refactor: embed *flag.FlagSet
Embed *flag.FlagSet directly into the subcommand types.
2023-08-11 19:26:24 +01:00
Dan Anglin cee274318d
feat: add FlagSets to create new subcommands
Create new FlagSets to create new subcommands.

- The version subcommand prints the version and build info.
- The generate subcommand generates the CV PDF documentation.
2023-08-11 18:33:26 +01:00
Dan Anglin 69c3165fc1
build: replace make with mage
- Replace the makefile with the magefile
- Update the Dockerfile
- Update go.mod
2023-08-11 14:59:21 +01:00
Dan Anglin 52868d7aa8
fix: add version and print with --version
Add a version variable that is printed to screen with the --version
flag.

Add a basic Makefile for building and installing spruce.
2023-03-08 00:42:04 +00:00
Dan Anglin fa8dbe68e9
feat(BREAKING): limit shown employment history
Allow users to limit the amount of employment history shown in the PDF
document by specifying a time range. This is a breaking change as the
structure of the CV needs to slightly change. The employment's start and
end dates need to be represented as integers.

Additional refactoring:

- The CV type is now in the internal cv package.
- The template functions are now in the internal templateFuncs package.
2023-03-02 17:40:04 +00:00
Dan Anglin 76fbe5c704
fix: more flexibility in Links and Contact section
Add more flexibility for the Links and Contact sections by removing the
strict types and replacing them with map[string]string.
2023-02-23 20:36:51 +00:00
Dan Anglin 38218f5811
fix(breaking): change technologies to skills 2023-02-23 19:53:57 +00:00
Dan Anglin ac1139b6d1
chore: renamed project to spruce 2023-02-23 19:44:06 +00:00
Dan Anglin 21d7b3c447
fix: update the Dockerfile
Changes:

- Build the cv-builder tool using go build instead of mage -compile in the first stage.
- The final docker image is now based on Alpine.
- Create a copy function to copy the final CV from the temporary directory to the final destination.
- Replace os.Rename with the custom copy function to support copying files between different filesystems.
2023-02-21 08:30:31 +00:00
Dan Anglin 39881b6965
chore: go mod tidy 2023-02-19 07:42:25 +00:00
Dan Anglin 11b9d4df15
feat: new cv builder tool
New CV builder tool migrated from the private repository.
2023-02-18 21:01:28 +00:00
Dan Anglin 60227b15b4 Initial commit 2023-02-14 07:43:15 +00:00