Add env subcommand

This commit is contained in:
zvecr
2021-04-05 21:01:29 +01:00
parent 78e0fda2f0
commit 054e071787
2 changed files with 22 additions and 0 deletions
+1
View File
@@ -3,4 +3,5 @@
We list each subcommand here explicitly because all the reliable ways of searching for modules are slow and delay startup.
"""
from . import clone # noqa
from . import env # noqa
from . import setup # noqa
+21
View File
@@ -0,0 +1,21 @@
"""Prints environment information.
"""
import os
from milc import cli
@cli.argument('var', default=None, nargs='?', help='Optional variable to query')
@cli.subcommand('Prints environment information.')
def env(cli):
data = {
'QMK_HOME' : os.environ.get('QMK_HOME', "")
}
if cli.args.var:
# dump out requested arg
print(data[cli.args.var])
else:
# dump out everything
for key,val in data.items():
print(f'{key}="{val}"')