More complete help message.

master
Luka Vandervelden 2020-12-12 17:49:45 +01:00
parent cc3620b4ad
commit 9d4b2adf7b
1 changed files with 12 additions and 2 deletions

View File

@ -50,6 +50,14 @@ class RootFS::Context
@configuration = Baguette::Configuration.new "rootfs" @configuration = Baguette::Configuration.new "rootfs"
end end
def print_commands_help
STDOUT << "commands:" << "\n"
STDOUT << " new <template> <rootfs-directory>\n"
STDOUT << " save <rootfs-directory> <snapshot-directory>\n"
STDOUT << " restore <rootfs-directory> <snapshot-directory>\n"
# Other commands are not implemented at the moment.
end
def run def run
options_parser = uninitialized OptionParser options_parser = uninitialized OptionParser
@ -71,7 +79,8 @@ class RootFS::Context
}, },
# FIXME: This needs access to the list of commands. # FIXME: This needs access to the list of commands.
"help" => ->(args : Array(String)){ "help" => ->(args : Array(String)){
STDOUT << options_parser << "\n" STDOUT << options_parser << "\n\n"
print_commands_help
} }
} }
@ -86,7 +95,8 @@ class RootFS::Context
end end
parser.on "-h", "--help", "Displays this help message." do parser.on "-h", "--help", "Displays this help message." do
STDOUT << parser << "\n" STDOUT << parser << "\n\n"
print_commands_help
exit 0 exit 0
end end