Class: RepoTender::CLI::Daemon::Status
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- RepoTender::CLI::Daemon::Status
- Includes:
- Helpers, GlobalOptions
- Defined in:
- lib/repo_tender/cli/daemon.rb
Instance Method Summary collapse
Methods included from GlobalOptions
Methods included from Helpers
build_plist, fail_with, format_failure, make_agent, plist_path
Instance Method Details
#call(plain: nil, json: nil, no_color: nil, quiet: nil) ⇒ Object
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/repo_tender/cli/daemon.rb', line 259 def call(plain: nil, json: nil, no_color: nil, quiet: nil, **) mode = UI::Mode.resolve( flags: {plain: plain, json: json, no_color: no_color, quiet: quiet}, env: CLI.env, out: out ) pastel = Pastel.new(enabled: mode.color) label = Launchd::Agent::DEFAULT_LABEL agent = make_agent result = agent.status if result.failure? return fail_with(self, "status failed: #{format_failure(result.failure)}") end s = result.success out.puts pastel.cyan("label: #{label}") out.puts pastel.cyan("loaded: #{s[:loaded]}") out.puts pastel.cyan("running: #{s[:running]}") out.puts pastel.cyan("pid: #{s[:pid].inspect}") out.puts pastel.cyan("last_exit: #{s[:last_exit].inspect}") CLI.record_outcome(Outcome.new(exit_code: 0)) end |