Skip to content

Commit 0ac0f22

Browse files
committed
Replaced --init .config.jsonc w/ .json5 to support inline comments
1 parent a9937a7 commit 0ac0f22

8 files changed

Lines changed: 18 additions & 18 deletions

File tree

File renamed without changes.

remove-json-keys/docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Options can be set by using command-line arguments:
4343
| ------------------- | ------------------------------------------------------------------------------- | -----------------------------
4444
| `-d`, `--json-dir` | Name of the folder containing JSON files (default: `_locales`) | `--json-dir=data`
4545
| `-k`, `--keys` | Comma-separated list of keys to remove | `--keys=appDesc,err_notFound`
46-
| `-i`, `--init` | Create .remove-json-keys.config.jsonc in project root to store default settings |
46+
| `-i`, `--init` | Create .remove-json-keys.config.json5 in project root to store default settings |
4747
| `-W`, `--no-wizard` | Skip interactive prompts during start-up |
4848
| `-h`, `--help` | Show help screen |
4949

@@ -69,11 +69,11 @@ remove-json -k app_DESC,app_VER -d data -W
6969

7070
## Config file
7171

72-
Use `--init` to create `.remove-json-keys.config.jsonc` in your project root to set default options.
72+
Use `--init` to create `.remove-json-keys.config.json5` in your project root to set default options.
7373

7474
Example defaults:
7575

76-
```jsonc
76+
```json5
7777
{
7878
"json_dir": "_locales", // name of the folder containing JSON files
7979
"keys": "", // Keys to remove (e.g. "appName,author")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def config_file(cli):
2121
log.warn(f'Config already exists at {cli.config_filepath}. Skipping --init.')
2222
log.tip('Pass --force to overwrite.')
2323
return
24-
cli.config_filename = f'.{cli.name}.config.jsonc'
24+
cli.config_filename = f'.{cli.name}.config.json5'
2525
cli.config_filepath = os.path.join(cli.project_root, cli.config_filename)
2626
if not getattr(cli, 'default_file_config', None):
2727
try:

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
),
1515
init=sn(
1616
args=['-i', '--init'],
17-
action='store_true', help='Create .remove-json-keys.config.jsonc file to store default options'
17+
action='store_true', help='Create .remove-json-keys.config.json5 file to store default options'
1818
),
1919
force=sn(
2020
args=['-f', '--force', '--overwrite'],
@@ -37,12 +37,12 @@ def load(cli, caller_file):
3737
cli.project_root = path.join(path.dirname(caller_file),
3838
f"../../{ '' if 'src' in path.dirname(caller_file) else '../../' }")
3939
possible_config_filenames = [
40-
f'.{cli.name}.config.jsonc', f'{cli.name}.config.jsonc',
41-
f'.{cli.name}.config.json', f'{cli.name}.config.json',
4240
f'.{cli.name}.config.json5', f'{cli.name}.config.json5',
43-
f'.{cli.short_name}.config.jsonc', f'{cli.short_name}.config.json',
41+
f'.{cli.name}.config.json', f'{cli.name}.config.json',
42+
f'.{cli.name}.config.jsonc', f'{cli.name}.config.jsonc',
43+
f'.{cli.short_name}.config.json5', f'{cli.short_name}.config.json5',
4444
f'.{cli.short_name}.config.json', f'{cli.short_name}.config.json',
45-
f'.{cli.short_name}.config.json5', f'{cli.short_name}.config.json',
45+
f'.{cli.short_name}.config.jsonc', f'{cli.short_name}.config.jsonc',
4646
]
4747
for filename in possible_config_filenames:
4848
cli.config_filepath = path.join(cli.project_root, filename)
File renamed without changes.

translate-messages/docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Options can be set by using command-line arguments:
4646
| `-k`, `--keys` | Comma-separated list of keys to translate | `--keys=app_DESC,err_NOT_FOUND`
4747
| `--exclude-langs` | Comma-separated list of languages to exclude | `--exclude-langs=en,es`
4848
| `--exclude-keys` | Comma-separated list of keys to ignore | `--exclude-keys=app_NAME,author`
49-
| `-i`, `--init` | Create `.translate-msgs.config.jsonc` in project root to store default options |
49+
| `-i`, `--init` | Create `.translate-msgs.config.json5` in project root to store default options |
5050
| `-f`, `--force` | Force overwrite of existing config file when using `--init` |
5151
| `-W`, `--no-wizard` | Skip interactive prompts during start-up |
5252
| `-h`, `--help` | Show help screen |
@@ -73,11 +73,11 @@ translate-msgs -k app_DESC,err_NOT_FOUND -d _msgs -t es,hi -W
7373

7474
## Config file
7575

76-
Use `--init` to create `.translate-msgs.config.jsonc` in your project root to set default options.
76+
Use `--init` to create `.translate-msgs.config.json5` in your project root to set default options.
7777

7878
Example defaults:
7979

80-
```jsonc
80+
```json5
8181
{
8282
"locales_dir": "_locales", // Name of the folder containing locale files
8383
"target_langs": "", // Languages to translate to (e.g. "en,es,fr") (default: all supported locales)

translate-messages/src/translate_messages/lib/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def config_file(cli):
1515
log.warn(f'Config already exists at {cli.config_filepath}. Skipping --init.')
1616
log.tip('Pass --force to overwrite.')
1717
return
18-
cli.config_filename = f'.{cli.short_name}.config.jsonc'
18+
cli.config_filename = f'.{cli.short_name}.config.json5'
1919
cli.config_filepath = os.path.join(cli.project_root, cli.config_filename)
2020
if not getattr(cli, 'default_file_config', None):
2121
try:

translate-messages/src/translate_messages/lib/settings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
),
2727
init=sn(
2828
args=['-i', '--init'],
29-
action='store_true', help='Create .translate-msgs.config.jsonc file to store default options'
29+
action='store_true', help='Create .translate-msgs.config.jsojson5nc file to store default options'
3030
),
3131
force=sn(
3232
args=['-f', '--force', '--overwrite'],
@@ -49,12 +49,12 @@ def load(cli, caller_file):
4949
cli.project_root = path.join(path.dirname(caller_file),
5050
f"../../{ '' if 'src' in path.dirname(caller_file) else '../../' }")
5151
possible_config_filenames = [
52-
f'.{cli.short_name}.config.jsonc', f'{cli.short_name}.config.jsonc',
53-
f'.{cli.short_name}.config.json', f'{cli.short_name}.config.json',
5452
f'.{cli.short_name}.config.json5', f'{cli.short_name}.config.json5',
55-
f'.{cli.name}.config.jsonc', f'{cli.name}.config.jsonc',
56-
f'.{cli.name}.config.json', f'{cli.name}.config.json',
53+
f'.{cli.short_name}.config.json', f'{cli.short_name}.config.json',
54+
f'.{cli.short_name}.config.jsonc', f'{cli.short_name}.config.jsonc',
5755
f'.{cli.name}.config.json5', f'{cli.name}.config.json5',
56+
f'.{cli.name}.config.json', f'{cli.name}.config.json',
57+
f'.{cli.name}.config.jsonc', f'{cli.name}.config.jsonc',
5858
]
5959
for filename in possible_config_filenames:
6060
cli.config_filepath = path.join(cli.project_root, filename)

0 commit comments

Comments
 (0)