File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ license-files = [
1919]
2020dependencies = [
2121 " colorama>=0.4.6,<1.0.0 ; platform_system == 'Windows'" ,
22+ " find-project-root>=1.0.1,<2.0.0" ,
2223 " json5>=0.9.0,<1.0.0" ,
23- " project-markers>=1.0.0,<2.0.0" ,
2424 " ucs-detect>=2.0.2,<3.0.0"
2525]
2626requires-python = " >=3.8,<4.0"
Original file line number Diff line number Diff line change 2121 },
2222 "commit_hashes" : {
2323 "data" : " ca32452" ,
24- "locales" : " 2e62364 "
24+ "locales" : " dc652d9 "
2525 }
2626}
Original file line number Diff line number Diff line change @@ -13,14 +13,17 @@ def cli() -> sn:
1313 return cli
1414
1515def config_file (cli : sn ) -> None : # for --init
16- import project_markers
17- target_path = Path .cwd () / f'.{ cli .short_name } .config.json5'
18- in_project_root = None
19- if not any ((Path .cwd () / marker ).exists () for marker in project_markers ): # type: ignore
20- log .warn (f'{ cli .msgs .warn_NO_PROJECT_ROOT_FOUND_IN } { Path .cwd ()} ' )
16+ import find_project_root
17+ project_root = find_project_root (max_depth = 20 ) # type: ignore
18+ if project_root :
19+ target_path = Path (project_root ) / f'.{ cli .short_name } .config.json5'
20+ in_project_root = True
21+ else :
22+ log .warn (cli .msgs .NO_PROJECT_ROOT_FOUND )
2123 user_resp = input (f'{ cli .msgs .prompt_INIT_CONFIG_HERE_ANYWAY } ? (y/N): ' ).strip ().lower ()
2224 if not user_resp .startswith ('y' ) : return
23- else : in_project_root = True # for move tip
25+ target_path = Path .cwd () / f'.{ cli .short_name } .config.json5'
26+ in_project_root = False
2427
2528 # Handle existing file
2629 if target_path .exists ():
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ license-files = [
1919]
2020dependencies = [
2121 " colorama>=0.4.6,<1.0.0 ; platform_system == 'Windows'" ,
22+ " find-project-root>=1.0.1,<2.0.0" ,
2223 " json5>=0.9.0,<1.0.0" ,
23- " project-markers>=1.0.0,<2.0.0" ,
2424 " translate>=3.8.0,<4.0.0" ,
2525 " ucs-detect>=2.0.2,<3.0.0"
2626]
Original file line number Diff line number Diff line change 2929 ],
3030 "commit_hashes" : {
3131 "data" : " ca32452" ,
32- "locales" : " 2e62364 "
32+ "locales" : " dc652d9 "
3333 }
3434}
Original file line number Diff line number Diff line change @@ -14,14 +14,17 @@ def cli() -> sn:
1414 return cli
1515
1616def config_file (cli : sn ) -> None : # for --init
17- import project_markers
18- target_path = Path .cwd () / f'.{ cli .short_name } .config.json5'
19- in_project_root = None
20- if not any ((Path .cwd () / marker ).exists () for marker in project_markers ): # type: ignore
21- log .warn (f'{ cli .msgs .warn_NO_PROJECT_ROOT_FOUND_IN } { Path .cwd ()} ' )
17+ import find_project_root
18+ project_root = find_project_root (max_depth = 20 ) # type: ignore
19+ if project_root :
20+ target_path = Path (project_root ) / f'.{ cli .short_name } .config.json5'
21+ in_project_root = True
22+ else :
23+ log .warn (cli .msgs .NO_PROJECT_ROOT_FOUND )
2224 user_resp = input (f'{ cli .msgs .prompt_INIT_CONFIG_HERE_ANYWAY } ? (y/N): ' ).strip ().lower ()
2325 if not user_resp .startswith ('y' ) : return
24- else : in_project_root = True # for move tip
26+ target_path = Path .cwd () / f'.{ cli .short_name } .config.json5'
27+ in_project_root = False
2528
2629 # Handle existing file
2730 if target_path .exists ():
You can’t perform that action at this time.
0 commit comments