@@ -14,9 +14,11 @@ def run_editor(file: Path):
1414 """Open editor on file"""
1515 c_editor = ctx .obj ["devcli.commands.edit.editor" ]
1616 e_editor = os .getenv ("EDITOR" , "vim" )
17+ logger .info (f"env EDITOR={ e_editor } config={ c_editor } " )
1718
1819 # config first, env and last default
1920 editor = c_editor if c_editor else e_editor
21+ logger .info (f"selected editor: { editor } " )
2022
2123 os .execvp (editor , [editor , file ])
2224
@@ -27,18 +29,23 @@ def open_editor(file: Path):
2729
2830
2931@cli .command ()
30- def config (ctx : Context ):
32+ def config (ctx : Context , dry : bool = False ):
33+ """ Opens the most specific configuration """
3134 editor = prep_editor (ctx )
3235 configs = ctx .obj .files ()
36+ logger .info (f"Found these configurations: { configs } " )
3337 if not configs :
3438 cmd .stop ("No configuration files were found." )
35-
36- # last file is the most specific one
37- editor (configs [- 1 ])
39+ elif dry :
40+ cmd .info (f"Will edit: { configs [- 1 ]} " )
41+ else :
42+ # last file is the most specific one
43+ editor (configs [- 1 ])
3844
3945
4046@cli .command ("command" )
4147def edit_command (ctx : Context , name : str ):
48+ """ Opens the command [name] for edit """
4249 editor = prep_editor (ctx )
4350 configs = ctx .obj .files ()
4451 p = Path (configs [- 1 ]).parent
0 commit comments