subCommands top-level property
Implementation
final List<FigSubcommand> subCommands = [
Subcommand(
name: 'check',
description: 'Run Ruff on the given files or directories',
options: checkOptions,
args: [
Arg(
name: 'Path',
template: 'filepaths',
description: 'The path to use for the project/script',
defaultValue: '.',
isVariadic: true
)
]
),
Subcommand(
name: 'rule',
description: 'Explain a rule (or all rules)',
args: [
Arg(
name: 'rule',
description: 'Rule(s) to explain',
suggestions: [
...rules,
FigSuggestion(
name: '--all',
description: 'Explain all rules'
)
]
)
],
options: [
Option(
name: '--all',
description: 'Explain all rules'
),
Option(
name: '--output-format',
description: 'Output format [default: text]',
args: [
Arg(
name: 'output-format',
suggestions: [
FigSuggestion(name: 'text'),
FigSuggestion(name: 'json')
]
)
]
)
]
),
Subcommand(
name: 'config',
description: 'List or describe the available configuration options',
options: [
Option(
name: '--output-format',
description: 'Output format [default: text]',
args: [
Arg(
name: 'output-format',
suggestions: [
FigSuggestion(name: 'text'),
FigSuggestion(name: 'json')
]
)
]
)
]
),
Subcommand(
name: 'linter',
description: 'List all supported upstream linters',
options: [
Option(
name: '--output-format',
description: 'Output format',
args: [
Arg(
name: 'output-format',
suggestions: [
FigSuggestion(name: 'text'),
FigSuggestion(name: 'json')
]
)
]
)
]
),
Subcommand(
name: 'clean',
description: 'Clear any caches in the current directory and any subdirectories'
),
Subcommand(
name: 'format',
description: 'Run the Ruff formatter on the given files or directories',
options: formatOptions,
args: [
Arg(
name: 'Path',
template: 'filepaths',
description: 'List of files or directories to format [default: .]',
defaultValue: '.',
isVariadic: true
)
]
),
Subcommand(
name: 'server',
description: 'Run the language server',
options: [
Option(
name: '--preview',
description: 'Enable preview mode. Use `--no-preview` to disable'
),
Option(
name: '--no-preview',
description: 'Disable preview mode'
)
]
),
Subcommand(
name: 'analyze',
description: 'Run analysis over Python source code',
subcommands: [
Subcommand(
name: 'graph',
description: 'Generate a map of Python file dependencies or dependents',
options: [
Option(
name: '--direction',
description: 'The direction of the import map. By default, generates a dependency map, i.e., a map from file to files that it depends on. Use `--direction dependents` to generate a map from file to files that depend on it',
args: [
Arg(
name: 'DIRECTION',
suggestions: [
FigSuggestion(name: 'dependencies'),
FigSuggestion(name: 'dependents')
]
)
]
),
Option(
name: '--detect-string-imports',
description: 'Attempt to detect imports from string literals'
),
Option(
name: '--preview',
description: 'Enable preview mode. Use `--no-preview` to disable'
),
Option(
name: '--no-preview',
description: 'Disable preview mode'
),
Option(
name: '--target-version',
description: 'The minimum Python version that should be supported',
args: [
Arg(
name: 'TARGET_VERSION',
suggestions: [
FigSuggestion(name: 'py37'),
FigSuggestion(name: 'py38'),
FigSuggestion(name: 'py39'),
FigSuggestion(name: 'py310'),
FigSuggestion(name: 'py311'),
FigSuggestion(name: 'py312'),
FigSuggestion(name: 'py313')
]
)
]
)
],
args: [
Arg(
name: 'Path',
template: 'filepaths',
description: 'The path to use for the project/script',
defaultValue: '.',
isVariadic: true
)
]
)
]
),
Subcommand(
name: 'version',
description: 'Display Ruff\'s version',
options: [
Option(
name: '--output-format',
description: 'Output format',
args: [
Arg(
name: 'output-format',
suggestions: [
FigSuggestion(name: 'text'),
FigSuggestion(name: 'json')
]
)
]
)
]
),
Subcommand(
name: 'help',
description: 'Print this message or the help of the given subcommand(s)'
)
];