From 67f392e1204023337586fd44d73b7f5d426cc2f6 Mon Sep 17 00:00:00 2001 From: "Julie B." Date: Fri, 27 Aug 2021 18:43:56 +0200 Subject: [PATCH] add template subcommand --- USAGE.md | 5 ++++- tool/main.bash | 3 +++ tool/main_arg.bash | 2 +- tool/template.bash | 5 +++++ tool/template_arg.bash | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tool/template.bash create mode 100644 tool/template_arg.bash diff --git a/USAGE.md b/USAGE.md index a6677ad..100c92f 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2,7 +2,10 @@ ## Imperative guests A guest declaration must live in a Nix Flake. To get started, you can use the -flake template. +flake template with the following shortcut: +```sh +miniguest template my-guests/ +``` To build and deploy a guest, run ```sh diff --git a/tool/main.bash b/tool/main.bash index c098362..f3e4180 100644 --- a/tool/main.bash +++ b/tool/main.bash @@ -39,4 +39,7 @@ remove) create) source create.bash ;; +template) + source template.bash + ;; esac diff --git a/tool/main_arg.bash b/tool/main_arg.bash index d9315a6..caaae14 100644 --- a/tool/main_arg.bash +++ b/tool/main_arg.bash @@ -16,7 +16,7 @@ # along with Miniguest. If not, see . # ARG_POSITIONAL_SINGLE(command, subcommand to run) -# ARG_TYPE_GROUP_SET(commands, COMMAND, command, [install,upgrade,remove,create,help]) +# ARG_TYPE_GROUP_SET(commands, COMMAND, command, [install,upgrade,remove,create,template,help]) # ARG_OPTIONAL_SINGLE(guests-dir, , directory containing guests profiles, /etc/miniguests) # ARG_OPTIONAL_SINGLE(nix, , path to the nix binary, @nixFlakes@/bin/nix) # ARG_LEFTOVERS(subcommand arguments) diff --git a/tool/template.bash b/tool/template.bash new file mode 100644 index 0000000..2439a1a --- /dev/null +++ b/tool/template.bash @@ -0,0 +1,5 @@ +source template_arg.bash + +dest_dir="$_arg_dest_dir" + +run_nix flake new -t github:bbjubjub2494/miniguest "$dest_dir" diff --git a/tool/template_arg.bash b/tool/template_arg.bash new file mode 100644 index 0000000..bb3cd56 --- /dev/null +++ b/tool/template_arg.bash @@ -0,0 +1,2 @@ +# ARG_POSITIONAL_SINGLE(dest-dir, destination directory) +# ARGBASH_GO