DannyBen/bashly

View on GitHub
examples/settings/README.md

Summary

Maintainability
Test Coverage
# Settings Example

Demonstrates how to use the bashly `settings.yml` file to configure some 
aspects of the script generation commands.

This example was generated with:

```bash
$ bashly add settings
# ... now edit settings.yml to match the example ...
$ bashly init
$ bashly generate
```

<!-- include: settings.yml -->

-----

## `bashly.yml`

````yaml
name: cli
help: Sample application
version: 0.1.0

environment_variables:
- name: api_key
  help: Set your API key

commands:
- name: download
  alias: d
  help: Download a file

  args:
  - name: source
    required: true
    help: URL to download from
  - name: target
    help: "Target filename (default: same as source)"

  flags:
  - long: --force
    short: -f
    help: Overwrite existing files

  examples:
  - cli download example.com
  - cli download example.com ./output -f

  environment_variables:
  - name: default_target_location
    help: Set the default location to download to

- name: upload
  alias: u
  help: Upload a file
  args:
  - name: source
    required: true
    help: File to upload

  flags:
  - long: --user
    short: -u
    arg: user
    help: Username to use for logging in
    required: true
  - long: --password
    short: -p
    arg: password
    help: Password to use for logging in
````

## `settings.yml`

````yaml
target_dir: out
strict: true

````


## Output

### `$ ./out/cli`

````shell
cli - Sample application

Usage:
  cli COMMAND
  cli [COMMAND] --help | -h
  cli --version | -v

Commands:
  download   Download a file
  upload     Upload a file



````