2626 ),
2727 init = sns (
2828 args = ['-i' , '--init' ],
29- action = 'store_true' , help = 'Create .translate-msgs.config.json file to store defaults'
29+ action = 'store_true' , help = 'Create .translate-msgs.config.jsonc file to store defaults'
3030 ),
3131 force = sns (
3232 args = ['-f' , '--force' , '--overwrite' ],
@@ -48,15 +48,21 @@ def load(cli, caller_file):
4848 cli .config = sns ()
4949 cli .project_root = path .join (path .dirname (caller_file ),
5050 f"../../{ '' if 'src' in path .dirname (caller_file ) else '../../' } " )
51+ if not getattr (cli , 'short_name' , None ) : cli .short_name = cli .name .replace ('messages' , 'msgs' )
5152 possile_config_filenames = [
52- '.translate-msgs.config.json' , 'translate-msgs.config.json' ,
53- 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.json' ,
55+ f'.{ cli .short_name } .config.json5' , f'{ cli .short_name } .config.json' ,
56+ f'.{ cli .name } .config.json' , f'{ cli .name } .config.json' ,
57+ f'.{ cli .name } .config.jsonc' , f'{ cli .name } .config.jsonc' ,
58+ f'.{ cli .name } .config.json5' , f'{ cli .name } .config.json5' ,
5459 ]
5560 for filename in possile_config_filenames :
5661 cli .config_filepath = path .join (cli .project_root , filename )
5762 if path .exists (cli .config_filepath ):
5863 cli .config = data .sns .from_dict (data .json .read (cli .config_filepath ))
5964 cli .config_filename = filename
65+ print (cli .config ) ; exit ()
6066 break
6167
6268 # Parse CLI args
0 commit comments