Command line interface module

This module contains all classes and functions required to run the scaffold from the command line.

exception bsb.cli.ParseError[source]

Thrown when the parsing of a command string fails.

class bsb.cli.ReplState[source]

Stores the REPL state and executes each step of the REPL.

add_parser_globals()[source]

Adds subparsers and arguments that should be there in any state.

add_subparser(*args, **kwargs)[source]

Add a top level subparser to the current REPL parser.

clear_prefix()[source]

Clear the REPL prefix.

close_hdf5()[source]

Closes the currently open HDF5 file.

Raises

ParseError – Raised if there’s no open HDF5 file.

Return type

None

destroy_globals()[source]

Always called before the REPL exits to clean up open resources.

exit_repl(args)[source]

Exit the REPL.

open_hdf5(args)[source]

Callback function that handles the open hdf5 command.

Parameters

args (Namespace) – Result of ArgumentParser.parse_args()

Return type

None

open_morphology_repository(args)[source]

Callback function that handles the open mr command.

Parameters

args (Namespace) – Result of ArgumentParser.parse_args()

Return type

None

repl()[source]

Execute the next repl step.

set_next_state(state)[source]

Set the next REPL state.

Parameters

state (string) – The next state. For each state there should be a set_parser_``state``_state function (e.g. set_parser_base_state()).

Return type

None

set_parser_base_hdf5_state()[source]

Adds the HDF5 state subparsers and arguments to the REPL parser.

set_parser_base_mr_state()[source]

Adds the morphology repository state subparsers and arguments to the REPL parser.

set_parser_base_state()[source]

Adds the initial subparsers and arguments to the REPL parser.

set_reply(message)[source]

Set the REPL reply, to be printed to the user at the end of this step.

Parameters

message (string) – The reply to print.

Return type

None

update_parser()[source]

Creates a new parser for the next REPL step. Tries to add subparsers and arguments if the method “set_parser_``state``_state” is callable.

bsb.cli.check_positive_factory(name)[source]

Return a function to report whether a certain value is a positive integer. If it isn’t, raise an ArgumentTypeError.

bsb.cli.repl_plot_morphology(morphology_repository, args)[source]

Callback function that handles plot command in the base_mr state.

bsb.cli.repl_view_hdf5(handle, args)[source]

Callback function that handles view command in the base_hdf5 state.

bsb.cli.repl_voxelize(morphology_repository, args)[source]

Callback function that handles voxelize command in the base_mr state.

bsb.cli.scaffold_cli()[source]

console_scripts entry point for the scaffold package. Will start the CLI handler or REPL handler.

bsb.cli.start_cli()[source]

Scaffold package CLI handler

bsb.cli.start_repl()[source]

Scaffold package REPL handler. Will parse user commands.