2019-07-02 18:33:32 +00:00
|
|
|
def action_extensions(base_actions, project_path=None):
|
|
|
|
def echo(name, *args, **kwargs):
|
|
|
|
print(name, args, kwargs)
|
|
|
|
|
2019-11-25 10:47:55 +00:00
|
|
|
def verbose(name, ctx, args):
|
2021-01-26 02:49:01 +00:00
|
|
|
print('Output from test-verbose')
|
2019-11-25 10:47:55 +00:00
|
|
|
if args.verbose:
|
2021-01-26 02:49:01 +00:00
|
|
|
print('Verbose mode on')
|
2019-11-25 10:47:55 +00:00
|
|
|
|
2019-07-02 18:33:32 +00:00
|
|
|
# Add global options
|
|
|
|
extensions = {
|
2021-01-26 02:49:01 +00:00
|
|
|
'global_options': [
|
2019-07-02 18:33:32 +00:00
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-0'],
|
|
|
|
'help': 'Non-deprecated option.',
|
|
|
|
'deprecated': False
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-1'],
|
|
|
|
'help': 'Deprecated option 1.',
|
|
|
|
'deprecated': True
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-2'],
|
|
|
|
'help': 'Deprecated option 2.',
|
|
|
|
'deprecated': 'Please update your parameters.'
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-3'],
|
|
|
|
'help': 'Deprecated option 3.',
|
|
|
|
'deprecated': {
|
|
|
|
'custom_message': 'Please update your parameters.'
|
2019-07-02 18:33:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-4'],
|
|
|
|
'help': 'Deprecated option 4.',
|
|
|
|
'deprecated': {
|
|
|
|
'since': 'v4.0',
|
|
|
|
'removed': 'v5.0'
|
2019-07-02 18:33:32 +00:00
|
|
|
}
|
|
|
|
},
|
2019-11-14 12:48:24 +00:00
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-5'],
|
|
|
|
'help': 'Deprecated option 5.',
|
|
|
|
'deprecated': {
|
|
|
|
'since': 'v2.0',
|
|
|
|
'removed': 'v3.0',
|
|
|
|
'exit_with_error': True
|
2019-11-14 12:48:24 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-02 18:33:32 +00:00
|
|
|
],
|
2021-01-26 02:49:01 +00:00
|
|
|
'actions': {
|
|
|
|
'test-verbose': {
|
|
|
|
'callback': verbose,
|
|
|
|
'help': 'Command that have some verbosity',
|
2019-11-25 10:47:55 +00:00
|
|
|
},
|
2021-01-26 02:49:01 +00:00
|
|
|
'test-0': {
|
|
|
|
'callback': echo,
|
|
|
|
'help': 'Non-deprecated command 0',
|
|
|
|
'options': [
|
2019-07-02 18:33:32 +00:00
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-sub-0'],
|
|
|
|
'help': 'Non-deprecated subcommand option 0',
|
|
|
|
'default': None,
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
{
|
2021-01-26 02:49:01 +00:00
|
|
|
'names': ['--test-sub-1'],
|
|
|
|
'help': 'Deprecated subcommand option 1',
|
|
|
|
'default': None,
|
|
|
|
'deprecated': True
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
],
|
2021-01-26 02:49:01 +00:00
|
|
|
'arguments': [{
|
|
|
|
'names': ['test-arg-0'],
|
2019-07-02 18:33:32 +00:00
|
|
|
}],
|
|
|
|
},
|
2021-01-26 02:49:01 +00:00
|
|
|
'test-1': {
|
|
|
|
'callback': echo,
|
|
|
|
'help': 'Deprecated command 1',
|
|
|
|
'deprecated': 'Please use alternative command.'
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
2021-01-26 02:49:01 +00:00
|
|
|
'test-2': {
|
|
|
|
'callback': echo,
|
|
|
|
'help': 'Deprecated command 2',
|
|
|
|
'deprecated': {
|
|
|
|
'exit_with_error': True
|
2019-11-14 12:48:24 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-02 18:33:32 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return extensions
|