Class: Toys::StandardCLI

Inherits:
CLI
  • Object
show all
Defined in:
lib/toys/standard_cli.rb

Overview

Subclass of Toys::CLI configured for the behavior of the standard Toys executable.

Constant Summary collapse

CONFIG_DIR_NAME =

Standard toys configuration directory name.

Returns:

  • (String)
".toys"
CONFIG_FILE_NAME =

Standard toys configuration file name.

Returns:

  • (String)
".toys.rb"
INDEX_FILE_NAME =

Standard index file name in a toys configuration.

Returns:

  • (String)
".toys.rb"
PRELOAD_DIR_NAME =

Standard preload directory name in a toys configuration.

Returns:

  • (String)
".preload"
PRELOAD_FILE_NAME =

Standard preload file name in a toys configuration.

Returns:

  • (String)
".preload.rb"
DATA_DIR_NAME =

Standard data directory name in a toys configuration.

Returns:

  • (String)
".data"
EXECUTABLE_NAME =

Name of the standard toys executable.

Returns:

  • (String)
"toys"
EXTRA_DELIMITERS =

Delimiter characters recognized.

Returns:

  • (String)
":."
DEFAULT_ROOT_DESC =

Short description for the standard root tool.

Returns:

  • (String)
"Your personal command line tool"
DEFAULT_ROOT_LONG_DESC =

Help text for the standard root tool.

Returns:

  • (String)
"Toys is your personal command line tool. You can write commands using a simple Ruby DSL," \
" and Toys will automatically organize them, parse arguments, and provide documentation." \
" Tools can be global or scoped to specific directories. You can also use Toys instead of" \
" Rake to provide build and maintenance scripts for your projects." \
" For detailed information, see https://dazuma.github.io/toys"
DEFAULT_VERSION_FLAG_DESC =

Short description for the version flag.

Returns:

  • (String)
"Show the version of Toys."
TOYS_PATH_ENV =

Name of the toys path environment variable.

Returns:

  • (String)
"TOYS_PATH"

Instance Method Summary collapse

Constructor Details

#initialize(cur_dir: nil) ⇒ StandardCLI

Create a standard CLI, configured with the appropriate paths and middleware.

Parameters:

  • cur_dir (String, nil) (defaults to: nil)

    Starting search directory for configs. Defaults to the current working directory.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/toys/standard_cli.rb', line 93

def initialize(cur_dir: nil)
  super(
    executable_name: EXECUTABLE_NAME,
    config_dir_name: CONFIG_DIR_NAME,
    config_file_name: CONFIG_FILE_NAME,
    index_file_name: INDEX_FILE_NAME,
    preload_file_name: PRELOAD_FILE_NAME,
    preload_dir_name: PRELOAD_DIR_NAME,
    data_dir_name: DATA_DIR_NAME,
    extra_delimiters: EXTRA_DELIMITERS,
    middleware_stack: default_middleware_stack,
    template_lookup: default_template_lookup
  )
  add_standard_paths(cur_dir: cur_dir)
end