cli: move doctor to core, add doc
This commit is contained in:
parent
dab29a44b5
commit
8019389ccb
4 changed files with 27 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
This file is an overview of *documented* modules.
|
This file is an overview of *documented* modules.
|
||||||
There are many more, see [[file:../README.org::#whats-inside]["What's inside"]] for the full list of modules, I'm progressively working on documenting them.
|
There are many more, see [[file:../README.org::#whats-inside]["What's inside"]] for the full list of modules, I'm progressively working on documenting them.
|
||||||
|
|
||||||
|
If you have some issues with the setup, see [[file:SETUP.org::#troubleshooting]["Troubleshooting"]].
|
||||||
|
|
||||||
* TOC
|
* TOC
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:TOC: :include all
|
:TOC: :include all
|
||||||
|
|
|
@ -19,6 +19,7 @@ You'd be really helping me, I want to make the setup as straightforward as possi
|
||||||
- [[#setting-up-modules][Setting up modules]]
|
- [[#setting-up-modules][Setting up modules]]
|
||||||
- [[#private-configuration-myconfig][private configuration (my.config)]]
|
- [[#private-configuration-myconfig][private configuration (my.config)]]
|
||||||
- [[#module-dependencies][module dependencies]]
|
- [[#module-dependencies][module dependencies]]
|
||||||
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
- [[#usage-examples][Usage examples]]
|
- [[#usage-examples][Usage examples]]
|
||||||
- [[#end-to-end-roam-research-setup][End-to-end Roam Research setup]]
|
- [[#end-to-end-roam-research-setup][End-to-end Roam Research setup]]
|
||||||
- [[#polar][Polar]]
|
- [[#polar][Polar]]
|
||||||
|
@ -220,6 +221,16 @@ Dependencies are different for specific modules you're planning to use, so it's
|
||||||
|
|
||||||
Generally you can just try using the module and then install missing packages via ~pip3 install --user~, should be fairly straightforward.
|
Generally you can just try using the module and then install missing packages via ~pip3 install --user~, should be fairly straightforward.
|
||||||
|
|
||||||
|
|
||||||
|
* Troubleshooting
|
||||||
|
# todo replace with_my with it??
|
||||||
|
|
||||||
|
HPI comes with a command line tool that can help you detect potential issues. Run:
|
||||||
|
|
||||||
|
: hpi doctor
|
||||||
|
|
||||||
|
If you have any ideas on how to improve it, please let me know!
|
||||||
|
|
||||||
* Usage examples
|
* Usage examples
|
||||||
If you run your script with ~with_my~ wrapper, you'd have ~my~ in ~PYTHONPATH~ which gives you access to your data from within the script.
|
If you run your script with ~with_my~ wrapper, you'd have ~my~ in ~PYTHONPATH~ which gives you access to your data from within the script.
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,18 @@ import sys
|
||||||
from subprocess import check_call, run, PIPE
|
from subprocess import check_call, run, PIPE
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from my.core import LazyLogger
|
from . import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger('HPI cli')
|
log = LazyLogger('HPI cli')
|
||||||
|
|
||||||
class Modes:
|
class Modes:
|
||||||
HELLO = 'hello'
|
HELLO = 'hello'
|
||||||
CONFIG = 'config'
|
CONFIG = 'config'
|
||||||
|
DOCTOR = 'doctor'
|
||||||
|
|
||||||
|
|
||||||
def run_mypy(pkg):
|
def run_mypy(pkg):
|
||||||
from my.core.init import get_mycfg_dir
|
from .init import get_mycfg_dir
|
||||||
mycfg_dir = get_mycfg_dir()
|
mycfg_dir = get_mycfg_dir()
|
||||||
# todo ugh. not sure how to extract it from pkg?
|
# todo ugh. not sure how to extract it from pkg?
|
||||||
|
|
||||||
|
@ -79,6 +80,10 @@ def config_check(args):
|
||||||
sys.stderr.write(indent(mres.stdout.decode('utf8')))
|
sys.stderr.write(indent(mres.stdout.decode('utf8')))
|
||||||
|
|
||||||
|
|
||||||
|
def doctor(args):
|
||||||
|
config_check(args)
|
||||||
|
|
||||||
|
|
||||||
def hello(args):
|
def hello(args):
|
||||||
print('Hello')
|
print('Hello')
|
||||||
|
|
||||||
|
@ -94,11 +99,14 @@ Work in progress, will be used for config management, troubleshooting & introspe
|
||||||
hp = sp.add_parser(Modes.HELLO , help='TODO just a stub, remove later')
|
hp = sp.add_parser(Modes.HELLO , help='TODO just a stub, remove later')
|
||||||
hp.set_defaults(func=hello)
|
hp.set_defaults(func=hello)
|
||||||
|
|
||||||
|
dp = sp.add_parser(Modes.DOCTOR, help='Run various checks')
|
||||||
|
dp.set_defaults(func=doctor)
|
||||||
|
|
||||||
cp = sp.add_parser(Modes.CONFIG, help='Work with configuration')
|
cp = sp.add_parser(Modes.CONFIG, help='Work with configuration')
|
||||||
scp = cp.add_subparsers(dest='mode')
|
scp = cp.add_subparsers(dest='mode')
|
||||||
if True:
|
# if True:
|
||||||
ccp = scp.add_parser('check', help='Check config')
|
# ccp = scp.add_parser('check', help='Check config')
|
||||||
ccp.set_defaults(func=config_check)
|
# ccp.set_defaults(func=config_check)
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -68,7 +68,7 @@ def main():
|
||||||
'dataclasses',
|
'dataclasses',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
entry_points={'console_scripts': ['hpi=my.__main__:main']},
|
entry_points={'console_scripts': ['hpi=my.core.__main__:main']},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue