|
7 | 7 | controls = sn( |
8 | 8 | locales_dir=sn( |
9 | 9 | args=['-d', '--locales-dir', '--locales-folder', '--json-dir', '--json-folder'], |
10 | | - type=str, default_val='_locales', help='Name of the folder containing locale files (default: "_locales")' |
| 10 | + type=str, default_val='_locales' |
11 | 11 | ), |
12 | 12 | target_langs=sn( |
13 | | - args=['-t', '--target-langs', '--include-langs'], |
14 | | - type=str, parser='csv', help='Languages to translate to (e.g. "es,fr") (default: all 100+ supported locales)' |
15 | | - ), |
| 13 | + args=['-t', '--target-langs', '--include-langs'], type=str, parser='csv' ), |
16 | 14 | keys=sn( |
17 | | - args=['-k', '--keys', '--include-keys', '--translate-keys'], |
18 | | - type=str, parser='csv', help='Keys to translate (e.g. "app_DESC,err_NOT_FOUND") (default: all found src keys missing in target files)' |
19 | | - ), |
| 15 | + args=['-k', '--keys', '--include-keys', '--translate-keys'], type=str, parser='csv'), |
20 | 16 | exclude_langs=sn( |
21 | | - args=['--exclude-langs', '--ignore-langs'], |
22 | | - type=str, parser='csv', help='Languages to exclude (e.g. "es,zh")' |
23 | | - ), |
| 17 | + args=['--exclude-langs', '--ignore-langs'], type=str, parser='csv'), |
24 | 18 | exclude_keys=sn( |
25 | | - args=['--exclude-keys', '--ignore-keys'], |
26 | | - type=str, parser='csv', help='Keys to ignore (e.g. "app_NAME,author")' |
27 | | - ), |
| 19 | + args=['--exclude-keys', '--ignore-keys'], type=str, parser='csv'), |
28 | 20 | only_stable=sn( |
29 | | - args=['-s', '--only-stable', '--no-discovery'], |
30 | | - action='store_true', help='Only use stable locales (skip auto-discovery)' |
31 | | - ), |
| 21 | + args=['-s', '--only-stable', '--no-discovery'], action='store_true'), |
32 | 22 | init=sn( |
33 | | - args=['-i', '--init'], |
34 | | - action='store_true', subcmd='true', help='Create .translate-msgs.config.json5 file to store default options' |
35 | | - ), |
| 23 | + args=['-i', '--init'], action='store_true', subcmd='true'), |
36 | 24 | force=sn( |
37 | | - args=['-f', '--force', '--overwrite'], |
38 | | - action='store_true', help='Force overwrite existing config file when using init' |
39 | | - ), |
| 25 | + args=['-f', '--force', '--overwrite'], action='store_true'), |
40 | 26 | no_wizard=sn( |
41 | | - args=['-n', '-W', '--no-wizard', '--skip-wizard'], |
42 | | - action='store_true', default=None, help='Skip interactive prompts during start-up' |
43 | | - ), |
| 27 | + args=['-n', '-W', '--no-wizard', '--skip-wizard'], action='store_true', default=None), |
44 | 28 | help=sn( |
45 | | - args=['-h', '--help'], |
46 | | - action='help', help='Show help screen' |
47 | | - ), |
| 29 | + args=['-h', '--help'], action='help'), |
48 | 30 | debug=sn( |
49 | | - args=['--debug'], |
50 | | - action='store_true', help='Show debug logs' |
51 | | - ) |
| 31 | + args=['--debug'], action='store_true') |
52 | 32 | ) |
53 | 33 |
|
54 | 34 | def load(cli, caller_file): |
55 | 35 |
|
| 36 | + # Assign help tips from cli.msgs |
| 37 | + for ctrl_key, ctrl in vars(controls).items(): |
| 38 | + if not hasattr(ctrl, 'help') : ctrl.help = getattr(cli.msgs, f'help_{ctrl_key.upper()}') |
| 39 | + |
56 | 40 | # Load from config file |
57 | 41 | cli.config = sn() |
58 | 42 | caller_path = Path(caller_file) |
|
0 commit comments