Skip to content

Commit 6275798

Browse files
committed
Added canonical --keys
1 parent 690af38 commit 6275798

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

remove-json-keys/src/remove_json_keys/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ def main():
66

77
if not cli.config.no_wizard:
88
while True: # prompt user for keys to remove
9-
if getattr(cli.config, 'remove_keys', '') : print('Key(s) to remove:', cli.config.remove_keys)
9+
if getattr(cli.config, 'keys', '') : print('Key(s) to remove:', cli.config.keys)
1010
input_key = input("Enter key to remove (or ENTER if done): ")
1111
if not input_key : break
12-
cli.config.remove_keys.append(input_key)
12+
cli.config.keys.append(input_key)
1313

1414
log.trunc(f'\nSearching for {cli.config.json_dir}...')
1515
cli.config.json_dir = init.json_dir(cli.config.json_dir)
1616
if cli.config.json_dir : log.trunc(f'JSON directory found!\n\n>> {cli.config.json_dir}\n')
1717
else : log.trunc(f'Unable to locate a {cli.config.json_dir} directory.') ; sys.exit(1)
1818

19-
keys_removed, keys_skipped, files_processed_cnt = data.json.remove_keys(cli)
19+
keys_removed, keys_skipped, files_processed_cnt = data.json.keys(cli)
2020

2121
log.final_summary({
2222
'removed': [f'{key} ({file_path})' for key, file_path in keys_removed],

remove-json-keys/src/remove_json_keys/lib/init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ def cli():
1111
description="Remove key/value pairs from JSON files",
1212
add_help=False # disable default --help arg to re-create last
1313
)
14-
argp.add_argument('-k', '--remove-keys', type=str, help='Keys to remove (e.g. "appName,author")')
1514
argp.add_argument('-d', '--json-dir', '--json-folder',
1615
type=str, help='Name of the folder containing JSON files (default: "_locales")')
16+
argp.add_argument('-k', '--keys', '--remove-keys', type=str, help='Keys to remove (e.g. "appName,author")')
1717
argp.add_argument('-W', '--no-wizard', '--skip-wizard',
1818
action='store_true', default=None, help='Skip interactive prompts during start-up')
1919
argp.add_argument('-h', '--help', action='help', help="Show help screen")
2020
cli.config=sns()
2121
cli.config.__dict__.update({ key:val for key,val in vars(argp.parse_args()).items() if val is not None })
2222

2323
# Init cli.config vals
24-
cli.config.remove_keys = data.csv.parse(getattr(cli.config, 'remove_keys', None))
24+
cli.config.keys = data.csv.parse(getattr(cli.config, 'keys', None))
2525
cli.config.json_dir = getattr(cli.config, 'json_dir', '_locales')
2626
cli.config.no_wizard = getattr(cli.config, 'no_wizard', False)
2727

0 commit comments

Comments
 (0)