From 2e6f71842fad1e735252aa7f03aa8c925ed1d094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Fr=C3=A9rot?= Date: Mon, 30 Dec 2024 23:59:22 +0100 Subject: [PATCH] added subcommands structure --- rtenets | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 7 deletions(-) diff --git a/rtenets b/rtenets index 181554d..c74ba02 100755 --- a/rtenets +++ b/rtenets @@ -104,17 +104,17 @@ get_gitea_token(){ else TOKEN="$(enter "gitea token: ")" fi - readonly TOKEN } gitea() { check_api_prerequisites - readonly TOKEN if ! is_set TOKEN; then get_gitea_token fi + readonly TOKEN + local method="$1" local request="$2" local data="" @@ -172,6 +172,8 @@ init_repo() { \git init } +# ----------------- Tree commands ----------------------- + # Make bash script stub script_stub() { local script_name="$1" @@ -263,6 +265,8 @@ create_tenet_file_tree() { script_stub make_all_figures "Generating figures..." } +# ----------------- Gitea commands ----------------------- + get_gitea_owner() { gitea /user GET | jq -r '.login' } @@ -327,9 +331,25 @@ setup_dalembert_gitea() { setup_software_heritage_hook "${owner}" "${repo_name}" "${remote_http}" } +# ----------------- Script subcommands commands ----------------------- + +init-tree() { + declare desc="usage: rtenets init-tree " + + local directory="$1" +} + +init-gitea() { + true +} + +init-workflow() { + true +} # Create git repository -create_repo() { +create() { + declare desc="usage: rtenets create " local repo_name="$1" info "recursively creating directory '${repo_name}'" mkdir -p "${repo_name}" @@ -338,19 +358,70 @@ create_repo() { cd "${repo_name}" init_repo create_tenet_file_tree + setup_dalembert_gitea ) } # Print usage and exit usage() { - true + cat <