Command-line interface

Command-line tools for executing remodeling workflows.

run_remodel

Main command for executing remodeling operations on datasets.

run_remodel data_dir model_path [options]

Usage Example:

run_remodel /path/to/dataset operations.json --verbose

Module Reference:

Main command-line program for running the remodeling tools.

remodel.cli.run_remodel.get_parser()

Create a parser for the run_remodel command-line arguments.

Returns:

A parser for parsing the command line arguments.

Return type:

argparse.ArgumentParser

remodel.cli.run_remodel.handle_backup(args)

Restore the backup if applicable.

Parameters:

args (obj) – Parsed arguments as an object.

Returns:

Backup name if there was a backup done.

Return type:

Union[str, None]

remodel.cli.run_remodel.parse_arguments(arg_list=None)

Parse the command line arguments or arg_list if given.

Parameters:

arg_list (list) – List of command line arguments as a list.

Returns:

  • Argument object.

  • A list of parsed operations (each operation is a dictionary).

Return type:

Tuple[Object, list]

Raises:

ValueError – If the operations were unable to be correctly parsed.

remodel.cli.run_remodel.parse_tasks(files, task_args)

Parse the tasks argument to get a task list.

Parameters:
  • files (list) – List of full paths of files.

  • task_args (str or list) – The argument values for the task parameter.

remodel.cli.run_remodel.run_ops(dispatch, args, tabular_files)

Run the remodeler on files of a specified form in a directory tree.

Parameters:
  • dispatch (Dispatcher) – Controls the application of the operations and backup.

  • args (argparse.Namespace) – Dictionary of arguments and their values.

  • tabular_files (list) – List of files to include in this run.

remodel.cli.run_remodel.get_sidecar(data_dir, tsv_path)

Get the sidecar for a file if it exists.

Parameters:
  • data_dir (str) – Full path of the data directory.

  • tsv_path (str) – Full path of the file.

Returns:

The Sidecar if it exists, otherwise None.

Return type:

Union[Sidecar, None]

remodel.cli.run_remodel.main(arg_list=None)

The command-line program.

Parameters:

arg_list (list or None) – Called with value None when called from the command line. Otherwise, called with the command-line parameters as an argument list.

Raises:
  • HedFileError

  • - if the data root directory does not exist.

  • - if the specified backup does not exist.

run_remodel_backup

Command for creating backups of datasets before remodeling.

run_remodel_backup data_dir [options]

Usage Example:

run_remodel_backup /path/to/dataset --backup-name my_backup

Module Reference:

Command-line program for creating a remodeler backup.

remodel.cli.run_remodel_backup.get_parser()

Create a parser for the run_remodel_backup command-line arguments.

Returns:

A parser for parsing the command line arguments.

Return type:

argparse.ArgumentParser

remodel.cli.run_remodel_backup.main(arg_list=None)

The command-line program for making a remodel backup.

Parameters:

arg_list (list or None) – Called with value None when called from the command line. Otherwise, called with the command-line parameters as an argument list.

Raises:

HedFileError – If the specified backup already exists.

run_remodel_restore

Command for restoring datasets from backups.

run_remodel_restore data_dir [options]

Usage Example:

run_remodel_restore /path/to/dataset --backup-name my_backup

Module Reference:

Command-line program for restoring files from remodeler backup.

remodel.cli.run_remodel_restore.get_parser()

Create a parser for the run_remodel_restore command-line arguments.

Returns:

A parser for parsing the command line arguments.

Return type:

argparse.ArgumentParser

remodel.cli.run_remodel_restore.main(arg_list=None)

The command-line program for restoring a remodel backup.

Parameters:

arg_list (list or None) – Called with value None when called from the command line. Otherwise, called with the command-line parameters as an argument list.

Raises:

HedFileError – If the specified backup does not exist.

Common Options

All CLI commands share some common options:

  • -v, --verbose: Output detailed progress information

  • -bn, --backup-name: Name of the backup to use

  • -bd, --backup-dir: Directory for backup storage

  • -t, --task-names: Specify task names to process

  • -x, --exclude-dirs: Directories to exclude from processing

For complete option lists, use --help with any command:

run_remodel --help
run_remodel_backup --help
run_remodel_restore --help