bash-utils/awesome-tasks/odoo

75 lines
2.1 KiB
Plaintext
Raw Normal View History

2018-05-21 20:41:19 +02:00
#!/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
}
dl()
{
$__dirtask/download $@
}
################################################################################
__dirname="$(dirname $0)"
__dirtask="$__dirname/.$(basename $0)"
# Calls command (1rt argument) as script or function \$1( \$2 \$3 ... )
if [ -r "$__dirtask/$1" ]
2018-06-29 15:37:55 +02:00
verbose "Command file exists call it: $__dirtask/$1 ${*:2}"
$__dirtask/$1 ${*:2}
2018-05-21 20:41:19 +02:00
else
if [ -n "$(type -t $1)" ] && [ "$(type -t $1)" = function ];
then
2018-06-29 15:37:55 +02:00
verbose "$__dirtask/$1 not exists try func: $1 ${*:2}"
$1 "${*:2}"
2018-05-21 20:41:19 +02:00
fi
fi