module Main where import MiniCli.Command ( Command (PromoteCommand, ValidateCommand) , Environment (Production) , PromoteSpec (PromoteSpec) , ReleaseTrack (Stable) , ValidateSpec (ValidateSpec) , renderCommand , runCliParser ) import System.Exit (die) main :: IO () main = case ( runCliParser ["validate", "--service", "api", "--env", "production", "--replicas", "3", "--track", "stable"] , runCliParser ["promote", "--service", "api", "--from-tag", "blue", "--to-tag", "green", "--owner", "platform", "--owner", "security", "--dry-run"] , runCliParser ["validate", "--service", "api", "--replicas", "3", "--track", "stable"] ) of ( Right (ValidateCommand (ValidateSpec "api" Production 3 Stable)) , Right promoteCommand@(PromoteCommand (PromoteSpec "api" "blue" "green" ["platform", "security"] True)) , Left _ ) | renderCommand promoteCommand == "promote api, from blue, to green, owners platform/security, dry-run yes" -> putStrLn "test passed" _ -> die "unexpected optparse result"