#!/bin/bash ## Task odoo v1.0 ## Copyright (C) Thomas Di gregorio ## Licensed under MIT ## ## This task does something with the arguments. ## Usage: ## task @script.name COMMAND [option] PACKAGE... ## ## Commands: ## help COMMAND Shows the command's help. ## search e ## download | dl e ## install e ## ## Options: ## ( Long version are mandatory, and can be before or after short version ) ## ## -h, --help Show this help. ## -v, --verbose Show sub-task resolution and options parsed. ## -m, --module Search a module (default) on odoo.com website. ## -t, --theme Search a theme on odoo.com website. ## -z, --unzip Unzip the downloaded package. ## --in=VALUE Defines the docker dir of odoo addons to install the package in. ## ## Exemples: ## task odoo search web_responsive ## task odoo search --module web_responsive ## task odoo search -m web_responsive ## task odoo search --theme awesome_theme ## task odoo search -t awesome_theme ## task odoo dl -t awesome_theme --unzip ## task odoo dl web_responsive -z ## task odoo install awesome_theme --in odoo-test ## task odoo help COMMAND ## # write tour default options here module=yes source easyoptions || exit verbose() { [[ -n "$verbose" ]] && echo $1; } ##### YOUR CODE HERE ##### help() { verbose "HELP: $@" $__dirtask/$1 --help } ################################################################################ __dirname="$(dirname $0)" __dirtask="$__dirname/.$(basename $0)" # Calls command (1rt argument) as script or function \$1( \$2 \$3 ... ) if [ -r "$__dirtask/$1" ] verbose "Command file exists call it: \$__dirtask/\$1 \${*:2}" \$__dirtask/\$1 \${*:2} else if [ -n "$(type -t $1)" ] && [ "$(type -t $1)" = function ]; then verbose "\$__dirtask/\$1 not exists try func: \$1 \${*:2}" \$1 "\${*:2}" fi fi