Class: Space::Src::CLI::Daemon::Status
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Space::Src::CLI::Daemon::Status
- Includes:
- Helpers, GlobalOptions
- Defined in:
- lib/space_src/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
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/space_src/cli/daemon.rb', line 269 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) paths = CLI.make_paths old_pp = plist_path(paths, Migration::OLD_LABEL) if File.exist?(old_pp) err.puts pastel.yellow("warning: stale agent #{Migration::OLD_LABEL} detected; run `src daemon install` to upgrade") end 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 |