First commit
This commit is contained in:
parent
27de055abf
commit
2a1d399aaa
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash
|
||||
|
||||
##
|
||||
## Task download v1.0
|
||||
## Copyright (C) Thomas Di Gregorio
|
||||
## Licensed under MIT
|
||||
##
|
||||
## Downloads an odoo.com page corresponding to the package name given and type.
|
||||
##
|
||||
## Usage:
|
||||
## @script.name [ --theme | --module ] [ --unzip ] PACKAGE
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
##
|
||||
## Exemples:
|
||||
##
|
||||
##
|
||||
|
||||
# write tour default options here
|
||||
|
||||
source easyoptions || exit
|
||||
verbose() { [[ -n "" ]] && echo /home/dig/bin/.taskrc; }
|
||||
|
||||
##### YOUR CODE HERE #####
|
||||
name=${arguments[1]}
|
||||
|
||||
if [ -r "$PWD/$name.url" ]
|
||||
then
|
||||
verbose "Found a $name.url file containing: $(cat $name.url)"
|
||||
wget -O $name.zip "$(cat $name.url)"
|
||||
else
|
||||
verbose "No .url file, try given url: ${arguments[1]}""
|
||||
name=${arguments[2]}
|
||||
wget -O $name.zip ${arguments[1]}
|
||||
fi
|
||||
[[ -n "$unzip" ]] && unzip $name.zip
|
||||
|
||||
|
||||
##### SNIPPETS ##################################################################
|
||||
|
||||
|
||||
# Boolean and parameter options
|
||||
|
||||
# [[ -n "$option" ]] && echo "Option specified: --option is $option"
|
||||
|
||||
|
||||
# Arguments
|
||||
|
||||
#for argument in "${arguments[@]}"; do
|
||||
# echo "Argument specified: $argument"
|
||||
#done
|
||||
|
||||
|
||||
# Verbose (echo only if -v or --verbose options
|
||||
|
||||
#verbose "I\'m doing things"
|
||||
#mkdir "cant/create/this" || verbose "Error creating folder!"
|
||||
|
||||
# Auto called function acording to 1st agument
|
||||
|
||||
#command()
|
||||
#{
|
||||
# # here get 2nd argument with /home/dig/bin/.taskrc (local 1st arg) or (script)
|
||||
#}
|
||||
|
||||
|
||||
################################################################################
|
||||
__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
|
Loading…
Reference in New Issue