Sha256: 2e0de74b2f1ed531e6cf26b5d5f07496472b989f386c743ed1c740e4886f475c

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

#! /usr/bin/env ruby

require 'autoproj/cli/main'
require 'autoproj/cli/locate'

argv = Autoproj::CLI.basic_setup
if argv.include?('--help') || argv.include?('help')
    puts "Usage:"
    puts "  alog [package]"
    puts
    puts "Shows log available for the given package and allows to select and display one"
    exit 0
end

Autoproj.report(silent: true) do
    cli = Autoproj::CLI::Locate.new

    arg = argv.first || Dir.pwd
    if File.directory?(arg)
        arg = "#{File.expand_path(arg)}/"
    end
    log_files = cli.logs_of(arg, log: nil)

    if log_files.size == 1
        logfile = log_files.first
        puts File.read(logfile)
    elsif log_files.size > 1
        begin
            logfile = cli.select_log_file(log_files)
            puts File.read(logfile)
        rescue Interrupt
        end
    elsif log_files.empty?
        raise "no logs found for #{string}"
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
autoproj-2.14.0 bin/alog
autoproj-2.13.0 bin/alog