Module: GithubCLI::DSL
- Included in:
- GithubCLI
- Defined in:
- lib/github_cli/dsl.rb
Overview
Defines helpers
Instance Method Summary collapse
- #before(&block) ⇒ Object
- #configure(&block) ⇒ Object
-
#on_error ⇒ Object
Defines behaviour on error to emit consistent type.
-
#program_name(name = nil) ⇒ Object
Defines a program name.
Instance Method Details
#before(&block) ⇒ Object
41 42 |
# File 'lib/github_cli/dsl.rb', line 41 def before(&block) end |
#configure(&block) ⇒ Object
44 45 |
# File 'lib/github_cli/dsl.rb', line 44 def configure(&block) end |
#on_error ⇒ Object
Defines behaviour on error to emit consistent type.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/github_cli/dsl.rb', line 18 def on_error yield rescue Github::Error::NotFound => e terminal.newline ui.error 'Resource Not Found' terminal.newline exit 15 rescue GithubCLI::GithubCLIError => e GithubCLI.ui.error e. GithubCLI.ui.debug e exit e.status_code rescue Interrupt => e GithubCLI.ui.error "\nQuitting..." GithubCLI.ui.debug e exit 1 rescue SystemExit => e exit e.status rescue Exception => e GithubCLI.ui.error "\nFatal error has occurred. " + e..to_s GithubCLI.ui.debug e exit 1 end |
#program_name(name = nil) ⇒ Object
Defines a program name.
12 13 14 |
# File 'lib/github_cli/dsl.rb', line 12 def program_name(name = nil) @program_name = name || @program_name end |