First commit

This commit is contained in:
dig 2018-05-21 20:22:16 +02:00
parent e879c16a5d
commit 2eb4235489
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/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