abstract class fanr::Command

sys::Obj
  fanr::Command

Source

Command implements a top-level command in the fanr command line tool.

Commands declare their options using the CommandOpt facet which works similiar to AbstractMain. If the field is a Bool, then the option is treated as a flag option. Otherwise it must be one of these types: Str, Uri.

confirm

Bool confirm(Str msg)

Source

Ask for y/n confirmation or skip if -y option specified.

env

FanrEnv env()

Source

Get the local environment to use this command

err

Err err(Str msg, Err? cause := null)

Source

Throw an exception which may be used to unwind the stack back to main to indicate command failed and return non-zero

errTrace

@CommandOpt { name="errTrace"; help="Dump error stack traces" }
Bool errTrace

Source

Option to dump full stack trace on errors

name

abstract Str name()

Source

Name of command

out

OutStream out := Env.cur().out

Source

Stdout for printing command output

password

@CommandOpt { name="p"; help="Password for authentication"; config="password" }
Str? password

Source

Password for authentication

repo

Repo repo()

Source

Get the repo to use for this command:

  • default is config prop "repo"
  • override with "-r" option
repoUri

@CommandOpt { name="r"; help="Repository URI for command"; config="repo" }
Uri? repoUri

Source

Repository URI -r option

run

abstract Void run()

Source

Execute command. If there is a failure then throw err, otherwise the command is assumed to be successful.

skipConfirm

@CommandOpt { name="y"; help="Skip confirmation" }
Bool skipConfirm

Source

Option to skip confirmation (auto yes)

summary

abstract Str summary()

Source

Short summary of command for usage screen

usage

virtual Void usage(OutStream out := this.out)

Source

Print usage to given output stream

username

@CommandOpt { name="u"; help="Username for authentication"; config="username" }
Str? username

Source

Username for authentication

warn

Void warn(Str msg)

Source

Log a warning to out