diff --git a/config.json b/config.json index 1df5aeafcb05257ada03f06e072931b264a52942..ea717adeb266635c93d381f397011e1d33316b0c 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,10 @@ { - "moduls_directory": "tools/", + "commands_directory": "tools/", "allowed_scripts": ["python", "bash"], "ignored_dirs": ["CVS"], "update": "core/update.sh", - "version": "core/version.sh" + "version": "core/version.sh", + "commands_help": { + "core" :"Core functions of webis command.", + } } \ No newline at end of file diff --git a/readme.md b/readme.md index a3063dac601014019738ee52f277c9f96e52dc99..4edfa463854cc500e5e616ed9bf0bbee2d256fc6 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ authors: About ----- -webis is a command wrapping toolkit +"webis" is a command wrapping toolkit Requirements ------------ @@ -16,22 +16,23 @@ python3, pep8 Usage ----- -for first starts run: +For first starts run: > $./webis.py -h Configuration ------------- -see: config.json +See: config.json ``` { - "moduls_directory": "tools/", + "commands_directory": "tools/", "allowed_scripts": ["python", "bash"], - "ignored_dirs": ["CVS"] + "ignored_dirs": ["CVS"], + .... } ``` -Modules directory (tools) +Commands directory (tools) ------------------------- e.g.: ├── core @@ -44,9 +45,8 @@ e.g.: ├── t.oy └── t.txt -core and test are metanames for each toolkit -a call ->$./webis.py core help +"core" and "test" are metanames for each toolkit, a call +>$./webis.py core -h will print a short summary of all tools @@ -54,30 +54,39 @@ will print a short summary of all tools will perform a code style check of the tools directory -Adding a new Module +Adding a new Command ------------------- -first create a new folder in the "moduls_directory" with name FOLDER -add all scrips to this folder, e.g. MYSCRIPT.py - -check if +First create a new folder in the "commandss_directory" with name FOLDER add all scrips to this folder, +e.g. MYSCRIPT.py and check if >$./webis.py FOLDER MYSCRIPT -works +>$./webis.py FOLDER -h +>$./webis.py -h + +works. +Add in config.json the general description of the command in the "commands_help" part. ### Notes for MYSCRIPT -inside a new module directory, every script should have a small description comment -e.g.: +Inside a new command directory, every script should have a small description comment, e.g.: ``` #!/bin/bash # NICE DESCRIPTION ls / ``` -it is important for the './webis.py NAME help' call that this comment is the second line of the script, this approach can be seen as a extension of shebang +It is important for the './webis.py NAME -h' call that this comment is the second line of the script, this approach can be seen as a extension of shebang. + +### General scripts +All scripts must be code style checked with the "webis code checker" command. For python scripts this checks pep8 code style and for bash it checks the google bash style conventions. ### Bash scripts -use bashhelper functions (logError, ...) for output (see install for including) +Use bashhelper functions (logError, ...) for output (see install for including). ### Python scripts -use lib, log, system in "lib" directory for uniform outputs and reducing reinventing the wheel +Use lib, log, system in "lib" directory for uniform outputs and reducing reinventing the wheel. +Organize imports of each python script in the following way: + +1. python standard libraries +2. thirdparty imports +3. own imports Possible problems with new modules ---------------------------------- diff --git a/webis.py b/webis.py index 25a86ef764feeb477436096ca41960df54c96a46..35b1722a8b91a8989794e4e60ed03411c6d934c8 100755 --- a/webis.py +++ b/webis.py @@ -31,12 +31,10 @@ def load_config(): def get_commands(config): """Returns commands mapped to directories containing their subcommands.""" commands = collections.OrderedDict() - # FIXME: Variable names should be English only; also "moduls" has been - # renamed to "command". - for directory in os.listdir(config["moduls_directory"]): - if (os.path.isdir(config["moduls_directory"] + directory) and + for directory in os.listdir(config["commands_directory"]): + if (os.path.isdir(config["commands_directory"] + directory) and directory not in config["ignored_dirs"]): - commands[directory] = config["moduls_directory"] + directory + commands[directory] = config["commands_directory"] + directory return commands