49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
## Task odoo search v0.1.0
|
||
|
## Copyright (C) Thomas Di gregorio
|
||
|
## Licensed under MIT
|
||
|
##
|
||
|
## This task does something with the arguments.
|
||
|
## Usage:
|
||
|
## task odoo @script.name [option] PACKAGE...
|
||
|
##
|
||
|
## Options:
|
||
|
## ( Long version are mandatory, and can be before or after short version )
|
||
|
##
|
||
|
## -h, --help Show this help.
|
||
|
## -m, --module Search a module (default) on odoo.com website.
|
||
|
## -t, --theme Search a theme on odoo.com website.
|
||
|
##
|
||
|
## 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
|
||
|
|
||
|
type=module
|
||
|
|
||
|
source easyoptions || exit
|
||
|
|
||
|
# Boolean and parameter options
|
||
|
[[ -n "$module" ]] && type=module
|
||
|
[[ -n "$theme" ]] && type=theme
|
||
|
|
||
|
echo "Search for a $type at adoo.com"
|
||
|
type="$1"
|
||
|
name="$2"
|
||
|
url="https://www.odoo.com/apps/${type}s/11.0/${name}"
|
||
|
|
||
|
echo "Try $url"
|
||
|
wget -O $name.html $url
|
||
|
|
||
|
if [ -s $name.html ]
|
||
|
then
|
||
|
grep -o "https://apps.odoo.com/loempia/download/.*?deps" $name.html | sed 's/?deps//g' > $name.url
|
||
|
wget -O $name.zip "$(cat $name.url)"
|
||
|
unzip $name.zip
|
||
|
else
|
||
|
echo "Not found any $type"
|
||
|
fi
|