Skip to content

Latest commit

 

History

History

private-reveal

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Private Reveal Example

Demonstrates how to allow users to reveal any private commands, flags and environment variables.

This example was generated with:

$ bashly init
$ bashly add settings
# ... now edit settings.yml to match the example ...
# ... now edit src/bashly.yml to match the example ...
$ bashly generate

bashly.yml

name: cli
help: Sample application
version: 0.1.0

# All elements with `private: true` in this configuration will be hidden
# unless the environment variable SHOW_PELASE is set (as defined
# in ../settings.yml)

environment_variables:
- name: secret
  help: Set secret key
  private: true

flags:
- long: --debug
  help: Enable debug mode
  private: true

commands:
- name: admin
  help: Admin operations
  expose: true

  commands:
  - name: list
    help: List connected devices    
  - name: reboot
    help: Reboot
    private: true

settings.yml

# When using private commands, flags, or environment variables, you may set 
# this option to a name of an environment variable that, if set, will reveal
# all the private elements in the usage texts, as if they were public.
private_reveal_key: SHOW_PLEASE

Output

$ ./cli

cli - Sample application

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

Commands:
  admin          Admin operations


$ ./cli -h

cli - Sample application

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

Commands:
  admin          Admin operations
  admin list     List connected devices

Global Options:
  --help, -h
    Show this help

  --version, -v
    Show version number


$ ./cli admin -h

cli admin - Admin operations

Usage:
  cli admin COMMAND
  cli admin [COMMAND] --help | -h

Commands:
  list     List connected devices

Options:
  --help, -h
    Show this help


$ export SHOW_PLEASE=1

$ ./cli -h

cli - Sample application

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

Commands:
  admin          Admin operations
  admin list     List connected devices

Global Options:
  --help, -h
    Show this help

  --version, -v
    Show version number


$ ./cli admin -h

cli admin - Admin operations

Usage:
  cli admin COMMAND
  cli admin [COMMAND] --help | -h

Commands:
  list     List connected devices

Options:
  --help, -h
    Show this help