abt-cli 0.0.19 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/abt +3 -3
- data/lib/abt.rb +6 -6
- data/lib/abt/ari.rb +2 -2
- data/lib/abt/ari_list.rb +1 -1
- data/lib/abt/base_command.rb +7 -7
- data/lib/abt/cli.rb +49 -47
- data/lib/abt/cli/arguments_parser.rb +6 -3
- data/lib/abt/cli/global_commands.rb +23 -0
- data/lib/abt/cli/global_commands/commands.rb +23 -0
- data/lib/abt/cli/global_commands/examples.rb +23 -0
- data/lib/abt/cli/global_commands/help.rb +23 -0
- data/lib/abt/cli/global_commands/readme.rb +23 -0
- data/lib/abt/cli/global_commands/share.rb +36 -0
- data/lib/abt/cli/global_commands/version.rb +23 -0
- data/lib/abt/cli/prompt.rb +64 -52
- data/lib/abt/docs.rb +48 -26
- data/lib/abt/docs/cli.rb +3 -3
- data/lib/abt/docs/markdown.rb +10 -7
- data/lib/abt/git_config.rb +4 -6
- data/lib/abt/helpers.rb +26 -8
- data/lib/abt/providers/asana/api.rb +9 -9
- data/lib/abt/providers/asana/base_command.rb +12 -10
- data/lib/abt/providers/asana/commands/add.rb +13 -12
- data/lib/abt/providers/asana/commands/branch_name.rb +8 -8
- data/lib/abt/providers/asana/commands/clear.rb +7 -8
- data/lib/abt/providers/asana/commands/current.rb +14 -15
- data/lib/abt/providers/asana/commands/finalize.rb +17 -18
- data/lib/abt/providers/asana/commands/harvest_time_entry_data.rb +18 -16
- data/lib/abt/providers/asana/commands/init.rb +8 -41
- data/lib/abt/providers/asana/commands/pick.rb +22 -26
- data/lib/abt/providers/asana/commands/projects.rb +5 -5
- data/lib/abt/providers/asana/commands/share.rb +7 -5
- data/lib/abt/providers/asana/commands/start.rb +28 -21
- data/lib/abt/providers/asana/commands/tasks.rb +6 -6
- data/lib/abt/providers/asana/configuration.rb +37 -29
- data/lib/abt/providers/asana/path.rb +6 -6
- data/lib/abt/providers/devops/api.rb +12 -12
- data/lib/abt/providers/devops/base_command.rb +14 -10
- data/lib/abt/providers/devops/commands/boards.rb +5 -7
- data/lib/abt/providers/devops/commands/branch_name.rb +9 -9
- data/lib/abt/providers/devops/commands/clear.rb +7 -8
- data/lib/abt/providers/devops/commands/current.rb +17 -18
- data/lib/abt/providers/devops/commands/harvest_time_entry_data.rb +21 -19
- data/lib/abt/providers/devops/commands/init.rb +21 -14
- data/lib/abt/providers/devops/commands/pick.rb +25 -19
- data/lib/abt/providers/devops/commands/share.rb +7 -5
- data/lib/abt/providers/devops/commands/{work-items.rb → work_items.rb} +3 -3
- data/lib/abt/providers/devops/configuration.rb +15 -15
- data/lib/abt/providers/devops/path.rb +7 -6
- data/lib/abt/providers/git/commands/branch.rb +23 -21
- data/lib/abt/providers/harvest/api.rb +8 -8
- data/lib/abt/providers/harvest/base_command.rb +10 -8
- data/lib/abt/providers/harvest/commands/clear.rb +7 -8
- data/lib/abt/providers/harvest/commands/current.rb +13 -14
- data/lib/abt/providers/harvest/commands/init.rb +10 -39
- data/lib/abt/providers/harvest/commands/pick.rb +15 -11
- data/lib/abt/providers/harvest/commands/projects.rb +5 -5
- data/lib/abt/providers/harvest/commands/share.rb +7 -5
- data/lib/abt/providers/harvest/commands/start.rb +5 -3
- data/lib/abt/providers/harvest/commands/stop.rb +12 -12
- data/lib/abt/providers/harvest/commands/tasks.rb +7 -7
- data/lib/abt/providers/harvest/commands/track.rb +52 -37
- data/lib/abt/providers/harvest/configuration.rb +18 -18
- data/lib/abt/providers/harvest/path.rb +6 -6
- data/lib/abt/version.rb +1 -1
- metadata +12 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6b21c8f210a7c29d5f43ef7c756cfdcc7d8ef2b13ef4dcaef1cec4f8bf2297a1
         | 
| 4 | 
            +
              data.tar.gz: f7586aa063494d796ded7c2e8696d9bf834e24be3004c621408e2fdd58f9b516
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b9d5278daeec2067937212108eb0ba478c1ec80d45c14a94025f7d6d83c5a30c4cdb716d010a4dfc807166165cd04af8e7962ec2b776f9f2fb7feee7edb65194
         | 
| 7 | 
            +
              data.tar.gz: 2faba55f9dcf4ee66f82a77b647fe367fbebeb74c70fde23edd6543ad83ce1f995bdeb01673555219c498a971919e0b2fd0ec1f8362484f56ba6a54a2b65503c
         | 
    
        data/bin/abt
    CHANGED
    
    | @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 | 
             
            # frozen_string_literal: true
         | 
| 3 3 |  | 
| 4 | 
            -
            require_relative  | 
| 4 | 
            +
            require_relative "../lib/abt"
         | 
| 5 5 |  | 
| 6 6 | 
             
            begin
         | 
| 7 7 | 
             
              Abt::Cli.new.perform
         | 
| 8 8 | 
             
            rescue Abt::Cli::Abort => e
         | 
| 9 | 
            -
              abort | 
| 9 | 
            +
              abort(e.message.strip)
         | 
| 10 10 | 
             
            rescue Interrupt
         | 
| 11 | 
            -
              abort | 
| 11 | 
            +
              abort("Aborted")
         | 
| 12 12 | 
             
            end
         | 
    
        data/lib/abt.rb
    CHANGED
    
    | @@ -1,11 +1,11 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 6 | 
            -
            require  | 
| 7 | 
            -
            require  | 
| 8 | 
            -
            require  | 
| 3 | 
            +
            require "dry-inflector"
         | 
| 4 | 
            +
            require "faraday"
         | 
| 5 | 
            +
            require "oj"
         | 
| 6 | 
            +
            require "open3"
         | 
| 7 | 
            +
            require "stringio"
         | 
| 8 | 
            +
            require "optparse"
         | 
| 9 9 |  | 
| 10 10 | 
             
            Dir.glob("#{File.dirname(File.absolute_path(__FILE__))}/abt/*.rb").sort.each do |file|
         | 
| 11 11 | 
             
              require file
         | 
    
        data/lib/abt/ari.rb
    CHANGED
    
    | @@ -4,7 +4,7 @@ module Abt | |
| 4 4 | 
             
              class Ari
         | 
| 5 5 | 
             
                attr_reader :scheme, :path, :flags
         | 
| 6 6 |  | 
| 7 | 
            -
                def initialize(scheme | 
| 7 | 
            +
                def initialize(scheme: nil, path: nil, flags: [])
         | 
| 8 8 | 
             
                  @scheme = scheme
         | 
| 9 9 | 
             
                  @path = path
         | 
| 10 10 | 
             
                  @flags = flags
         | 
| @@ -14,7 +14,7 @@ module Abt | |
| 14 14 | 
             
                  str = scheme
         | 
| 15 15 | 
             
                  str += ":#{path}" if path
         | 
| 16 16 |  | 
| 17 | 
            -
                  [str, *flags].join( | 
| 17 | 
            +
                  [str, *flags].join(" ")
         | 
| 18 18 | 
             
                end
         | 
| 19 19 | 
             
              end
         | 
| 20 20 | 
             
            end
         | 
    
        data/lib/abt/ari_list.rb
    CHANGED
    
    
    
        data/lib/abt/base_command.rb
    CHANGED
    
    | @@ -5,11 +5,11 @@ module Abt | |
| 5 5 | 
             
                extend Forwardable
         | 
| 6 6 |  | 
| 7 7 | 
             
                def self.usage
         | 
| 8 | 
            -
                  raise NotImplementedError,  | 
| 8 | 
            +
                  raise NotImplementedError, "Command classes must implement .usage"
         | 
| 9 9 | 
             
                end
         | 
| 10 10 |  | 
| 11 11 | 
             
                def self.description
         | 
| 12 | 
            -
                  raise NotImplementedError,  | 
| 12 | 
            +
                  raise NotImplementedError, "Command classes must implement .description"
         | 
| 13 13 | 
             
                end
         | 
| 14 14 |  | 
| 15 15 | 
             
                def self.flags
         | 
| @@ -27,7 +27,7 @@ module Abt | |
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 | 
             
                def perform
         | 
| 30 | 
            -
                  raise NotImplementedError,  | 
| 30 | 
            +
                  raise NotImplementedError, "Command classes must implement #perform"
         | 
| 31 31 | 
             
                end
         | 
| 32 32 |  | 
| 33 33 | 
             
                private
         | 
| @@ -41,18 +41,18 @@ module Abt | |
| 41 41 |  | 
| 42 42 | 
             
                  result
         | 
| 43 43 | 
             
                rescue OptionParser::InvalidOption => e
         | 
| 44 | 
            -
                  abort | 
| 44 | 
            +
                  abort(e.message)
         | 
| 45 45 | 
             
                end
         | 
| 46 46 |  | 
| 47 47 | 
             
                def flag_parser
         | 
| 48 48 | 
             
                  @flag_parser ||= OptionParser.new do |opts|
         | 
| 49 49 | 
             
                    opts.banner = <<~TXT
         | 
| 50 | 
            -
                      #{self.class.description}
         | 
| 50 | 
            +
                      #{self.class.description.strip}
         | 
| 51 51 |  | 
| 52 | 
            -
                      Usage: #{self.class.usage}
         | 
| 52 | 
            +
                      Usage: #{self.class.usage.strip}
         | 
| 53 53 | 
             
                    TXT
         | 
| 54 54 |  | 
| 55 | 
            -
                    opts.on( | 
| 55 | 
            +
                    opts.on("-h", "--help", "Display this help")
         | 
| 56 56 |  | 
| 57 57 | 
             
                    self.class.flags.each do |(*flag)|
         | 
| 58 58 | 
             
                      opts.on(*flag)
         | 
    
        data/lib/abt/cli.rb
    CHANGED
    
    | @@ -7,11 +7,12 @@ end | |
| 7 7 | 
             
            module Abt
         | 
| 8 8 | 
             
              class Cli
         | 
| 9 9 | 
             
                class Abort < StandardError; end
         | 
| 10 | 
            +
             | 
| 10 11 | 
             
                class Exit < StandardError; end
         | 
| 11 12 |  | 
| 12 13 | 
             
                attr_reader :command, :aris, :input, :output, :err_output, :prompt
         | 
| 13 14 |  | 
| 14 | 
            -
                def initialize(argv: ARGV, input:  | 
| 15 | 
            +
                def initialize(argv: ARGV, input: $stdin, output: $stdout, err_output: $stderr)
         | 
| 15 16 | 
             
                  (@command, *remaining_args) = argv
         | 
| 16 17 | 
             
                  @input = input
         | 
| 17 18 | 
             
                  @output = output
         | 
| @@ -21,11 +22,16 @@ module Abt | |
| 21 22 | 
             
                end
         | 
| 22 23 |  | 
| 23 24 | 
             
                def perform
         | 
| 24 | 
            -
                   | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 25 | 
            +
                  if command.nil?
         | 
| 26 | 
            +
                    warn("No command specified, printing help\n\n")
         | 
| 27 | 
            +
                    @command = "help"
         | 
| 28 | 
            +
                  end
         | 
| 27 29 |  | 
| 28 | 
            -
                   | 
| 30 | 
            +
                  if global_command?
         | 
| 31 | 
            +
                    process_global_command
         | 
| 32 | 
            +
                  else
         | 
| 33 | 
            +
                    process_aris
         | 
| 34 | 
            +
                  end
         | 
| 29 35 | 
             
                end
         | 
| 30 36 |  | 
| 31 37 | 
             
                def print_ari(scheme, path, description = nil)
         | 
| @@ -56,29 +62,23 @@ module Abt | |
| 56 62 |  | 
| 57 63 | 
             
                private
         | 
| 58 64 |  | 
| 59 | 
            -
                def  | 
| 60 | 
            -
                   | 
| 61 | 
            -
                   | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
                   | 
| 72 | 
            -
                     | 
| 73 | 
            -
                     | 
| 74 | 
            -
                   | 
| 75 | 
            -
                    puts | 
| 76 | 
            -
                    true
         | 
| 77 | 
            -
                  when 'readme'
         | 
| 78 | 
            -
                    puts(Abt::Docs::Markdown.readme)
         | 
| 79 | 
            -
                    true
         | 
| 80 | 
            -
                  else
         | 
| 81 | 
            -
                    false
         | 
| 65 | 
            +
                def global_command?
         | 
| 66 | 
            +
                  return true if aris.empty?
         | 
| 67 | 
            +
                  return true if aris.first.scheme.nil?
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                  false
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                def process_global_command
         | 
| 73 | 
            +
                  command_class = GlobalCommands.command_class(command)
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                  abort("No such global command: #{command}, perhaps you forgot to add an ARI?") if command_class.nil?
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  begin
         | 
| 78 | 
            +
                    ari = aris.first || Abt::Ari.new
         | 
| 79 | 
            +
                    command_class.new(cli: self, ari: ari).perform
         | 
| 80 | 
            +
                  rescue Exit => e
         | 
| 81 | 
            +
                    puts e.message
         | 
| 82 82 | 
             
                  end
         | 
| 83 83 | 
             
                end
         | 
| 84 84 |  | 
| @@ -88,16 +88,14 @@ module Abt | |
| 88 88 | 
             
                  @sanitized_piped_args ||= begin
         | 
| 89 89 | 
             
                    input_string = input.read.strip
         | 
| 90 90 |  | 
| 91 | 
            -
                    abort | 
| 91 | 
            +
                    abort("No input from pipe") if input_string.nil? || input_string.empty?
         | 
| 92 92 |  | 
| 93 93 | 
             
                    # Exclude comment part of piped input lines
         | 
| 94 | 
            -
                    lines_without_comments = input_string.lines.map  | 
| 95 | 
            -
                      line.split(' # ').first
         | 
| 96 | 
            -
                    end
         | 
| 94 | 
            +
                    lines_without_comments = input_string.lines.map { |line| line.split(" # ").first }
         | 
| 97 95 |  | 
| 98 96 | 
             
                    # Allow multiple ARIs on a single piped input line
         | 
| 99 97 | 
             
                    # TODO: Force the user to pick a single ARI
         | 
| 100 | 
            -
                    joined_lines = lines_without_comments.join( | 
| 98 | 
            +
                    joined_lines = lines_without_comments.join(" ").strip
         | 
| 101 99 | 
             
                    joined_lines.split(/\s+/)
         | 
| 102 100 | 
             
                  end
         | 
| 103 101 | 
             
                end
         | 
| @@ -107,26 +105,30 @@ module Abt | |
| 107 105 |  | 
| 108 106 | 
             
                  aris.each do |ari|
         | 
| 109 107 | 
             
                    if used_schemes.include?(ari.scheme)
         | 
| 110 | 
            -
                      warn | 
| 108 | 
            +
                      warn("Dropping command for already used scheme: #{ari}")
         | 
| 111 109 | 
             
                      next
         | 
| 112 110 | 
             
                    end
         | 
| 113 111 |  | 
| 114 | 
            -
                     | 
| 115 | 
            -
                    next if command_class.nil?
         | 
| 116 | 
            -
             | 
| 117 | 
            -
                    print_command(command, ari) if output.isatty
         | 
| 118 | 
            -
                    begin
         | 
| 119 | 
            -
                      command_class.new(ari: ari, cli: self).perform
         | 
| 120 | 
            -
                    rescue Exit => e
         | 
| 121 | 
            -
                      puts e.message
         | 
| 122 | 
            -
                    end
         | 
| 123 | 
            -
             | 
| 124 | 
            -
                    used_schemes << ari.scheme
         | 
| 112 | 
            +
                    used_schemes << ari.scheme if process_ari(ari)
         | 
| 125 113 | 
             
                  end
         | 
| 126 114 |  | 
| 127 115 | 
             
                  return unless used_schemes.empty? && output.isatty
         | 
| 128 116 |  | 
| 129 | 
            -
                  abort | 
| 117 | 
            +
                  abort("No providers found for command and ARI(s)")
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                def process_ari(ari)
         | 
| 121 | 
            +
                  command_class = get_command_class(ari.scheme)
         | 
| 122 | 
            +
                  return false if command_class.nil?
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                  print_command(command, ari) if output.isatty
         | 
| 125 | 
            +
                  begin
         | 
| 126 | 
            +
                    command_class.new(ari: ari, cli: self).perform
         | 
| 127 | 
            +
                  rescue Exit => e
         | 
| 128 | 
            +
                    puts e.message
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                  true
         | 
| 130 132 | 
             
                end
         | 
| 131 133 |  | 
| 132 134 | 
             
                def get_command_class(scheme)
         | 
| @@ -137,7 +139,7 @@ module Abt | |
| 137 139 | 
             
                end
         | 
| 138 140 |  | 
| 139 141 | 
             
                def print_command(name, ari)
         | 
| 140 | 
            -
                  warn | 
| 142 | 
            +
                  warn("===== #{name.upcase} #{ari} =====")
         | 
| 141 143 | 
             
                end
         | 
| 142 144 | 
             
              end
         | 
| 143 145 | 
             
            end
         | 
| @@ -13,8 +13,11 @@ module Abt | |
| 13 13 | 
             
                    result = AriList.new
         | 
| 14 14 | 
             
                    rest = arguments.dup
         | 
| 15 15 |  | 
| 16 | 
            +
                    # If the first arg is a flag, it's for a global command
         | 
| 17 | 
            +
                    result << Ari.new(flags: take_flags(rest)) if flag?(rest.first)
         | 
| 18 | 
            +
             | 
| 16 19 | 
             
                    until rest.empty?
         | 
| 17 | 
            -
                      (scheme, path) = rest.shift.split( | 
| 20 | 
            +
                      (scheme, path) = rest.shift.split(":")
         | 
| 18 21 | 
             
                      flags = take_flags(rest)
         | 
| 19 22 |  | 
| 20 23 | 
             
                      result << Ari.new(scheme: scheme, path: path, flags: flags)
         | 
| @@ -37,11 +40,11 @@ module Abt | |
| 37 40 | 
             
                  end
         | 
| 38 41 |  | 
| 39 42 | 
             
                  def flag?(part)
         | 
| 40 | 
            -
                    part && part[0] ==  | 
| 43 | 
            +
                    part && part[0] == "-"
         | 
| 41 44 | 
             
                  end
         | 
| 42 45 |  | 
| 43 46 | 
             
                  def delimiter?(part)
         | 
| 44 | 
            -
                    part ==  | 
| 47 | 
            +
                    part == "--"
         | 
| 45 48 | 
             
                  end
         | 
| 46 49 | 
             
                end
         | 
| 47 50 | 
             
              end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Dir.glob("#{File.expand_path(__dir__)}/global_commands/*.rb").sort.each { |file| require file }
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module Abt
         | 
| 6 | 
            +
              class Cli
         | 
| 7 | 
            +
                module GlobalCommands
         | 
| 8 | 
            +
                  def self.command_names
         | 
| 9 | 
            +
                    constants.sort.map { |constant_name| Helpers.const_to_command(constant_name) }
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def self.command_class(name)
         | 
| 13 | 
            +
                    name = "help" if [nil, "-h", "--help"].include?(name)
         | 
| 14 | 
            +
                    name = "version" if ["-v", "--version"].include?(name)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    const_name = Helpers.command_to_const(name)
         | 
| 17 | 
            +
                    return unless const_defined?(const_name)
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    const_get(const_name)
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Abt
         | 
| 4 | 
            +
              class Cli
         | 
| 5 | 
            +
                module GlobalCommands
         | 
| 6 | 
            +
                  class Commands < Abt::BaseCommand
         | 
| 7 | 
            +
                    def self.usage
         | 
| 8 | 
            +
                      "abt commands"
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def self.description
         | 
| 12 | 
            +
                      "List all abt commands"
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    attr_reader :cli
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def perform
         | 
| 18 | 
            +
                      puts(Abt::Docs::Cli.commands)
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Abt
         | 
| 4 | 
            +
              class Cli
         | 
| 5 | 
            +
                module GlobalCommands
         | 
| 6 | 
            +
                  class Examples < Abt::BaseCommand
         | 
| 7 | 
            +
                    def self.usage
         | 
| 8 | 
            +
                      "abt examples"
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def self.description
         | 
| 12 | 
            +
                      "Print command examples"
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    attr_reader :cli
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def perform
         | 
| 18 | 
            +
                      puts(Abt::Docs::Cli.examples)
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Abt
         | 
| 4 | 
            +
              class Cli
         | 
| 5 | 
            +
                module GlobalCommands
         | 
| 6 | 
            +
                  class Help < Abt::BaseCommand
         | 
| 7 | 
            +
                    def self.usage
         | 
| 8 | 
            +
                      "abt help"
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def self.description
         | 
| 12 | 
            +
                      "Print abt usage text"
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    attr_reader :cli
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def perform
         | 
| 18 | 
            +
                      puts(Abt::Docs::Cli.help)
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Abt
         | 
| 4 | 
            +
              class Cli
         | 
| 5 | 
            +
                module GlobalCommands
         | 
| 6 | 
            +
                  class Readme < Abt::BaseCommand
         | 
| 7 | 
            +
                    def self.usage
         | 
| 8 | 
            +
                      "abt readme"
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def self.description
         | 
| 12 | 
            +
                      "Print markdown readme"
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    attr_reader :cli
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def perform
         | 
| 18 | 
            +
                      puts(Abt::Docs::Markdown.readme)
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Abt
         | 
| 4 | 
            +
              class Cli
         | 
| 5 | 
            +
                module GlobalCommands
         | 
| 6 | 
            +
                  class Share < Abt::BaseCommand
         | 
| 7 | 
            +
                    def self.usage
         | 
| 8 | 
            +
                      "abt share"
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def self.description
         | 
| 12 | 
            +
                      "Prints all project configuration as a single line of ARIs"
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    attr_reader :cli
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def perform
         | 
| 18 | 
            +
                      warn("Printing project configuration")
         | 
| 19 | 
            +
                      puts share_string
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    def share_string
         | 
| 23 | 
            +
                      @share_string ||= begin
         | 
| 24 | 
            +
                        aris = Abt.schemes.join(" ")
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                        input = StringIO.new(aris)
         | 
| 27 | 
            +
                        output = StringIO.new
         | 
| 28 | 
            +
                        Abt::Cli.new(argv: ["share"], output: output, input: input).perform
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                        output.string.strip.gsub(/\s+/, " ")
         | 
| 31 | 
            +
                      end
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
            end
         |