Commit 47d2b8ab authored by Steve Goering's avatar Steve Goering

fix command dir not found error

parent cd1bda40
......@@ -9,6 +9,7 @@
import os
import argparse
class AliasedSubParsersAction(argparse._SubParsersAction):
""" Based on : """
class _AliasedPseudoAction(argparse.Action):
......@@ -33,8 +33,21 @@ def check_commands_alias_definition(config):
def load_config():
"""Returns the configuration, based on the JSON configuration file."""
return json.loads(read_file(os.path.dirname(
config = json.loads(read_file(os.path.dirname(
os.path.realpath(__file__)) + "/config.json"))
if not os.path.isdir(config["commands_directory"]):
config["commands_directory"] = os.path.dirname(
os.path.realpath(__file__)) + "/" + config["commands_directory"]
if not os.path.isdir(config["commands_directory"]):
"moduls_directory {} is not a valid directory, "
"check config.json".format(config["commands_directory"]))
return config
except Exception as e:
lError("The file config.json is invalid.")
......@@ -98,6 +111,7 @@ def run_subcommand(subcommand, subcommandpath, params=[]):
lError("An error occurred while executing " + cmd)
return return_value
def translate_alias_to_command(config, alias):
"""Transforms a given alias to the unique command."""
for command in config["commands_aliases"]:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment