Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 96abdbc7 authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

feat: init config file

parent 791bc758
No related branches found
No related tags found
1 merge request!2Resolve "init : create the configuration file"
Pipeline #1291 passed with warnings
.mygb_config
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
# Constant # Constant
readonly USAGE=' readonly USAGE='
mygb.sh <command> [options] \n mygb.sh <command> [options]
\n
Command : \n Command :
init : create the configuration file \n init : create the configuration file
export : export from GitLab \n export : export from GitLab
import : import to GitLab \n import : import to GitLab
\n
Options : \n Options :
-h : print help \n -h : print help
-c path/to/conf : read one config file \n -c path/to/conf : read one config file
-p path/to/projet : export the projet \n -p path/to/projet : export the projet
-g path/to/group : export the group and is subgroups and projects \n -g path/to/group : export the group and is subgroups and projects
-a : export all my group and subgroup \n -a : export all my group and subgroup
' '
# Vars # Vars
...@@ -42,6 +42,7 @@ _help() { ...@@ -42,6 +42,7 @@ _help() {
} }
_load_config() { _load_config() {
echo "Loading ${config_file} ..."
if [[ -e ${config_file} ]]; then if [[ -e ${config_file} ]]; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source ${config_file} source ${config_file}
...@@ -67,9 +68,24 @@ _create_config() { ...@@ -67,9 +68,24 @@ _create_config() {
echo "${config_file}" echo "${config_file}"
} }
_export() {
exit 0
}
_import() {
exit 0
}
main() { main() {
echo "My GitLab Backup" echo "My GitLab Backup"
action=${1}
shift
while getopts c:p:g:ah flag; do while getopts c:p:g:ah flag; do
echo "Flag is ${flag}"
# shellcheck disable=SC2034
case "${flag}" in case "${flag}" in
c) config_file=${OPTARG} ;; c) config_file=${OPTARG} ;;
p) project=${OPTARG} ;; p) project=${OPTARG} ;;
...@@ -79,6 +95,13 @@ main() { ...@@ -79,6 +95,13 @@ main() {
esac esac
done done
case "${action}" in
init) _load_config ;;
export) _export ;;
import) _import ;;
*) _help ;;
esac
_load_config _load_config
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment