2024-06-28 17:09:58 +00:00
|
|
|
require "commander"
|
|
|
|
require "./faaso.cr"
|
|
|
|
|
|
|
|
cli = Commander::Command.new do |cmd|
|
|
|
|
cmd.use = "faaso"
|
|
|
|
cmd.long = "Functions as a Service, Open"
|
|
|
|
|
|
|
|
cmd.commands.add do |command|
|
|
|
|
command.use = "build"
|
2024-06-29 17:36:11 +00:00
|
|
|
command.short = "Build a funko"
|
|
|
|
command.long = "Build a funko's Docker image and upload it to registry"
|
2024-06-28 17:09:58 +00:00
|
|
|
command.run do |options, arguments|
|
|
|
|
Faaso::Commands::Build.new(options, arguments).run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
cmd.commands.add do |command|
|
|
|
|
command.use = "up"
|
2024-06-29 17:36:11 +00:00
|
|
|
command.short = "Ensure funkos are running"
|
|
|
|
command.long = "Start/unpause/create containers for requested funkos and ensure they are up."
|
2024-06-28 17:09:58 +00:00
|
|
|
command.run do |options, arguments|
|
|
|
|
Faaso::Commands::Up.new(options, arguments).run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-06-29 17:36:11 +00:00
|
|
|
cmd.commands.add do |command|
|
|
|
|
command.use = "deploy"
|
|
|
|
command.short = "Deploy latest images"
|
|
|
|
command.long = "Update containers for all funkos to latest image."
|
|
|
|
command.run do |options, arguments|
|
|
|
|
Faaso::Commands::Deploy.new(options, arguments).run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-06-28 17:09:58 +00:00
|
|
|
cmd.commands.add do |command|
|
|
|
|
command.use = "down"
|
|
|
|
command.short = "Stop a function"
|
|
|
|
command.long = "Stop a function in a container"
|
|
|
|
command.run do |options, arguments|
|
|
|
|
Faaso::Commands::Down.new(options, arguments).run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Commander.run(cli, ARGV)
|