This commit is contained in:
anki-code 2020-03-13 18:40:30 +03:00
parent 5d8b9b1437
commit ce175c4c24
2 changed files with 6 additions and 6 deletions

4
xxh
View file

@ -361,7 +361,7 @@ class Xxh:
argp.add_argument('+iff','++install-force-full', default=False, action='store_true', help="Removing the host xxh home and install xxh again. All installed packages on the host (e.g. pip packages) will be lost.")
argp.add_argument('+xc','++xxh-config', default=self.config_file, help=f"Xxh config file in yaml. Default: " + self.config_file)
argp.add_argument('+e','++env', dest='env', metavar='NAME=VAL ...', action='append', help="Setting environment variables")
argp.add_argument('+e64','++env-b64', dest='env', metavar='NAME=BASE64 ...', action='append', help="Setting environment variables base64 encoded")
argp.add_argument('+eb','++envb', dest='envb', metavar='NAME=BASE64 ...', action='append', help="Setting environment variables base64 encoded")
argp.add_argument('+E','++env-mode', action='store_true', help="Environment mode in case `source xxh.sh`")
argp.add_argument('+lh','++local-xxh-home', default=self.local_xxh_home, help=f"Local xxh home path. Default: {self.local_xxh_home}")
argp.add_argument('+hh','++host-xxh-home', default=self.host_xxh_home, help=f"Host xxh home path. Default: {self.host_xxh_home}")
@ -475,7 +475,7 @@ class Xxh:
self.password = password
env_args = self.prepare_env_args(opt.env)
env_args += self.prepare_env_args(opt.env_b64, to_base64=False)
env_args += self.prepare_env_args(opt.envb, to_base64=False)
opt.install = True if opt.install_force or opt.install_force_full else opt.install

View file

@ -6,7 +6,6 @@
# Usage in xonsh: source xxh.xsh [ordinary xxh arguments]
#
import sys
from base64 import b64encode
def b64e(s):
@ -23,9 +22,10 @@ for local_plugin_dir in local_plugins_dir.glob(f'*-xonsh-*'):
plugin_envs = f.read().split('\n')
for e in plugin_envs:
if e in ${...}:
if ['+v'] in sys.argv:
if ['+v'] in $ARGS:
print(f'Plugin {local_plugin_dir.name} environment: {e}='+${e}, file=sys.stderr)
env_args += ['+e64', "%s=%s" % ( e, b64e(${e}) ) ]
env_args += ['+eb', "%s=%s" % ( e, b64e(${e}) ) ]
xxh @(sys.argv[1:]) +s xonsh @(env_args)
echo ./xxh @($ARGS) +s xonsh @(env_args)
./xxh @($ARGS) +s xonsh @(env_args)