Skip to content

Commit d80af06

Browse files
committed
let --checkup test for external executables
* less * fzf and rework some formatting of the --checkup output.
1 parent 4452b8b commit d80af06

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Upcoming (TBD)
22
==============
33

4+
Features
5+
---------
6+
* `--checkup` now checks for external executables.
7+
8+
49
Bug Fixes
510
---------
611
* Watch command now returns correct time when ran as part of a multi-part query (#1565)

mycli/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,16 @@ def do_config_checkup(mycli: MyCli) -> None:
23562356
did_output_unsupported = False
23572357
did_output_deprecated = False
23582358

2359+
print('\n### External executables:\n')
2360+
for executable in [
2361+
'less',
2362+
'fzf',
2363+
]:
2364+
if shutil.which(executable):
2365+
print(f'The "{executable}" executable was found — good!')
2366+
else:
2367+
print(f'The recommended "{executable}" executable was not found — some functionality will suffer.')
2368+
23592369
indent = ' '
23602370
transitions = {
23612371
f'{indent}[main]\n{indent}default_character_set': f'{indent}[connection]\n{indent}default_character_set',
@@ -2364,7 +2374,8 @@ def do_config_checkup(mycli: MyCli) -> None:
23642374
reverse_transitions = {v: k for k, v in transitions.items()}
23652375

23662376
if not list(mycli.config.keys()):
2367-
print('\nThe local ~/,myclirc is missing or empty.\n')
2377+
print('\n### Missing file:\n')
2378+
print('The local ~/,myclirc is missing or empty.\n')
23682379
did_output_missing = True
23692380
else:
23702381
for section_name in mycli.config:
@@ -2432,7 +2443,8 @@ def do_config_checkup(mycli: MyCli) -> None:
24322443
'For more info on supported features, see the commentary and defaults at:\n\n * https://github.com/dbcli/mycli/blob/main/mycli/myclirc\n'
24332444
)
24342445
else:
2435-
print('User configuration all up to date!')
2446+
print('\n### Configuration:\n')
2447+
print('User configuration all up to date!\n')
24362448

24372449

24382450
if __name__ == "__main__":

0 commit comments

Comments
 (0)