Cmdline Reference

Cmdline Arguments

Generate change log in Markdown

usage: sgc [-h] [--config-file CONFIG_FILE] --start-ref START_REF --end-ref
           END_REF [--var VAR [VAR ...]] [--git-path GIT_PATH]
           [--template-file TEMPLATE_FILE]
           [--template-name {author_all_commits,root_folder_all_commits,jira_id_by_change_type,change_type_all_commits,author_by_change_type,jira_id_all_commits}]
           [--custom-attributes CUSTOM_ATTRIBUTES] [--output-file OUTPUT_FILE]
           [--entry-id ENTRY_ID] [--log-level {ERROR,WARN,INFO,DEBUG}]
           {print,save}

Positional Arguments

verb

Possible choices: print, save

Default: “print”

Named Arguments

--config-file

The path to a .sgc config file

--start-ref

The commit sha or git ref (tag/head/etc) that the comparison will start from

--end-ref

The commit sha or git ref (tag/head/etc) that the comparison will end at

--var

Arbitrary number of variables to supply to the Jinja2 Template

--git-path

The path (relative to the cwd or absolute) that contains the .git folder

Default: “.”

--template-file

The path (relative to the cwd or absolute) to a custom jinja2 template file

--template-name

Possible choices: author_all_commits, root_folder_all_commits, jira_id_by_change_type, change_type_all_commits, author_by_change_type, jira_id_all_commits

The name of one of the templates bundled with the SamsGenerateChangelog package

Default: “author_by_change_type”

--custom-attributes

A JSON dictionary of of custom attributes to make available under each file object in the template

--output-file

The path to a changelog file to update

--entry-id

An ID unique to this changelog entry that can be used to update it in future if required (normally the semantic version)

--log-level

Possible choices: ERROR, WARN, INFO, DEBUG

Log level

Default: “WARN”

Using –var

The argument –var expects two values separated by a space, and can be specified multiple times.

e.g.

sgc print --start-ref 0.0.4 --end-ref 1.0.0 --var header_text 0.0.1 --var change_number CR-1234

Of course, the additional variables will only do anything if you have a corresponding entry in your template that does something with the variable!

See Custom template variables for more info.

Using config files

All cmdline arguments can be specified in a .sgc config file in a yaml format.

See Using config files for examples.