module

Hwaro::CLI::Commands::Tool::FileGenerator

Shared by the tool platform / tool ci generators: the flag set and the "print it or write it, refusing to clobber" tail. Keeping one copy means the two commands cannot disagree on how --force, -o and --stdout behave.

Constants

FLAGS = [FlagInfo.new(short: "-o", long: "--output", description: "Output file path (default: auto-detected)", takes_value: true, value_hint: "PATH"), FlagInfo.new(short: nil, long: "--stdout", description: "Print to stdout instead of writing file"), FlagInfo.new(short: "-f", long: "--force", description: "Overwrite existing file without warning"), HELP_FLAG]

Instance methods

emit(filename : String, content : String, stdout_mode : Bool, force : Bool) : Nil

Print content (stdout_mode) or write it to filename, refusing to overwrite an existing file unless force.

Source