Sha256: 4df5b1637acb79316699f2871c28898d01728cc437d1cb59e0ecebdf7bd99237
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
# encoding: UTF-8 # frozen_string_literal: true require 'nrser/refinements/types' using NRSER::Types # Namespace # ======================================================================= module Locd module CLI module Command # Definitions # ======================================================================= class Agent < Base desc 'tail [OPTIONS] PATTERN [-- TAIL_OPTIONS]', "Tail agent logs" include_shared t[ groups: :pattern ] option :stream, desc: "Stream to tail. May omit if uses single log file.", aliases: ['-s'], type: :string, enum: ['out', 'err'] option :follow, desc: "Run with `tail -F`", aliases: [ 'f', 'F' ], type: :boolean def tail *tail_options agent = find_only! pattern path = case options[:stream] when nil paths = agent.log_paths unless paths.length == 1 raise Thor::RequiredArgumentMissingError.new binding.erb <<~END Agent `<%= agent.label %>` has multiple log files. out: <%= agent.out_path.to_s %> err: <%= agent.err_path.to_s %> Must specify one via the `--stream` option. END end paths[0] when 'out' agent.out_path when 'err' agent.err_path else raise "WTF" end cmd = ['tail'] cmd += ['-F'] if options[:follow] exec *cmd, *tail_options, path.to_s end # #tail end # /Namespace # ======================================================================= end # module Command end # module CLI end # module Locd
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
locd-0.1.13 | lib/locd/cli/command/agent/tail.rb |