Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Feb 18, 2023
1 parent 69b6f86 commit d7fb87a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 14 deletions.
58 changes: 48 additions & 10 deletions docs/sphinx/ug_cli.rst
Expand Up @@ -11,23 +11,61 @@ Basic Command
Use the ``--help`` or ``-h`` argument to get help::

$ yabs --help
usage: yabs [-h] [-v | -q] [-n] [--no-color] [-V] {run} ...
usage: yabs [-h] [-v | -q] [-n] [--no-color] [-V] {init,info,run} ...

Release workflow automation tools.

positional arguments:
{run} sub-command help
run run a workflow definition
{init,info,run} sub-command help
init create a new yabs configuration
info show project information and optionally run `check` task
run run a workflow definition

optional arguments:
-h, --help show this help message and exit
-v, --verbose increment verbosity by one (default: 3, range: 0..5)
-q, --quiet decrement verbosity by one
-n, --dry-run just simulate and log results, but don't change anything
--no-color prevent use of ansi terminal color codes
-V, --version display version info and exit (combine with -v for more information)

See also https://github.com/mar10/yabs
$


`init` command
==============

$ yabs init --help
usage: yabs init [-h] [-v | -q] [-n] [--no-color] [filename]

positional arguments:
filename path to new config file (default: ./yabs.yaml)

optional arguments:
-h, --help show this help message and exit
-v, --verbose increment verbosity by one (default: 3, range: 0..5)
-q, --quiet decrement verbosity by one
-n, --dry-run just simulate and log results, but don't change anything
--no-color prevent use of ansi terminal color codes
-V, --version display version info and exit (combine with -v for more information)
$

See also https://github.com/mar10/yabs

`info` command
==============

$ yabs info --help
usage: yabs init [-h] [-v | -q] [-n] [--no-color] [filename]

positional arguments:
filename path to new config file (default: ./yabs.yaml)

optional arguments:
-h, --help show this help message and exit
-v, --verbose increment verbosity by one (default: 3, range: 0..5)
-q, --quiet decrement verbosity by one
-n, --dry-run just simulate and log results, but don't change anything
--no-color prevent use of ansi terminal color codes
$


Expand All @@ -41,13 +79,13 @@ For example, publish a ne patch release::
See also the help::

$ yabs run --help
usage: yabs run [-h] [-v | -q] [-n] [--no-color] [--force] [--no-release] [--no-progress]
[--inc {major,minor,patch,postrelease}] [--no-bump] [--force-pre-bump] [--no-check] [--gh-draft] [--gh-pre]
[--no-winget-release]
usage: yabs run [-h] [-v | -q] [-n] [--no-color] [--force] [--no-release] [--progress]
[--inc {major,minor,patch,postrelease}] [--no-bump] [--force-pre-bump] [--no-check] [--gh-draft]
[--gh-pre] [--no-winget-release]
[workflow]

positional arguments:
workflow run a workflow definition
workflow path to workflow definition (default: ./yabs.yaml)

optional arguments:
-h, --help show this help message and exit
Expand All @@ -57,7 +95,7 @@ See also the help::
--no-color prevent use of ansi terminal color codes
--force allow to ignore some errors (like bumping above `max_increment`)
--no-release don't upload tags and assets to GitHub, PyPI, or winget-pkgs (but still build assets)
--no-progress do not display current progress table between tasks, even if verbose >= 3
--progress display current progress table between tasks
--inc {major,minor,patch,postrelease}
bump semantic version (used as default for `bump` task's `inc` option)
--no-bump run all 'bump' tasks in dry-run mode
Expand Down
18 changes: 14 additions & 4 deletions docs/sphinx/ug_quickstart.md
Expand Up @@ -2,16 +2,26 @@

1. Install *yabs* ([details](installation))

2. Create and edit the workflow definition script (*yabs.yaml*)
([details](ug_writing_scripts))
2. Create a definition script (*yabs.yaml*) inside your project directory
```bash
$ yabs init
```
and edit it to your needs ([details](ug_writing_scripts)).

3. Run the script:
3. Check the current project status
```bash
$ yabs info
```
Add the `--check` or `-c` argument to also test the release preconditions.

4. Run the script to make a new release:

```bash
$ yabs run --inc patch
```

Use the `--dry-run` or `-n` argument test the workflow without really releasing.<br>
Specify the `--inc` bump type (*patch*, *minor*, *major*, *postrelease*).<br>
Use the `--dry-run` or `-n` argument to test the workflow without really releasing.<br>
Use the `--verbose` or `-v` to increase verbosity. <br>
Use the `--workflow` argument to specify the location of the configuration
file if it is not at the default location *./yabs.yaml*.
Expand Down
5 changes: 5 additions & 0 deletions docs/sphinx/ug_writing_scripts.rst
Expand Up @@ -25,6 +25,11 @@ A simple confuguration script may look like this: |br|
See :doc:`ug_sample_yabs_yaml` for a complete configuration with all available
options and defaults.

.. note::

To get started, run ``yabs init`` inside your project's directory.
This will prompt for a few details and create a fresh ``yabs.yaml`` file.


Task Types
==========
Expand Down
6 changes: 6 additions & 0 deletions yabs/cmd_init.py
Expand Up @@ -22,8 +22,14 @@ def run(parser: ArgumentParser, args: Namespace):
target = Path(args.filename)
# target = Path(".") / "new-yabs.yaml"
target = target.absolute()
if not target.suffix:
target = target.with_suffix(".yaml")
if target.suffix != ".yaml":
raise click.BadArgumentUsage(f"Expected `.yaml` extension: {target}")
if target.exists():
click.confirm(f"Overwrite {target} ?", abort=True)
else:
click.echo(f"Creating {target}...")

full_repo_name = click.prompt("GitHub Repo name (format: USER/PROJECT)", type=str)
if full_repo_name.count("/") != 1:
Expand Down

0 comments on commit d7fb87a

Please sign in to comment.