Class: Abt::Cli::GlobalCommands::Share

Inherits:
BaseCommand show all
Defined in:
lib/abt/cli/global_commands/share.rb

Instance Attribute Summary collapse

Attributes inherited from BaseCommand

#ari, #flags

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

flags, #initialize

Constructor Details

This class inherits a constructor from Abt::BaseCommand

Instance Attribute Details

#cliObject (readonly)

Returns the value of attribute cli.



15
16
17
# File 'lib/abt/cli/global_commands/share.rb', line 15

def cli
  @cli
end

Class Method Details

.descriptionObject



11
12
13
# File 'lib/abt/cli/global_commands/share.rb', line 11

def self.description
  "Prints all project configuration as a single line of ARIs"
end

.usageObject



7
8
9
# File 'lib/abt/cli/global_commands/share.rb', line 7

def self.usage
  "abt share"
end

Instance Method Details

#performObject



17
18
19
20
# File 'lib/abt/cli/global_commands/share.rb', line 17

def perform
  warn("Printing project configuration")
  puts share_string
end

#share_stringObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/abt/cli/global_commands/share.rb', line 22

def share_string
  @share_string ||= begin
    aris = Abt.schemes.join(" ")

    input = StringIO.new(aris)
    output = StringIO.new
    Abt::Cli.new(argv: ["share"], output: output, input: input).perform

    output.string.strip.gsub(/\s+/, " ")
  end
end