Skip to content

Commit

Permalink
Show info header only on first command (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha authored Dec 1, 2023
1 parent b77be4e commit 43ef1be
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/cpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def self.all_base_commands
begin
config = Config.new(args, options)

show_info_header(config) if with_info_header
Cpl::Cli.show_info_header(config) if with_info_header

command_class.new(config).call
rescue RuntimeError => e
Expand All @@ -190,9 +190,9 @@ def self.all_base_commands
::Shell.abort("Unable to load command: #{e.message}")
end

private
def self.show_info_header(config)
return if @showed_info_header

def show_info_header(config)
rows = {}
rows["ORG"] = config.org || "NOT PROVIDED!"
rows["APP"] = config.app || "NOT PROVIDED!"
Expand All @@ -201,6 +201,8 @@ def show_info_header(config)
puts "#{key}: #{value}"
end

@showed_info_header = true

# Add a newline after the info header
puts
end
Expand Down

0 comments on commit 43ef1be

Please sign in to comment.