Class: GithubPolyglot::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/github_polyglot/cli.rb

Overview

Class for the command-line interface

Constant Summary collapse

FORMAT_OPTIONS =
%i[print json pretty-json svg].freeze

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



11
12
13
# File 'lib/github_polyglot/cli.rb', line 11

def initialize
  parser.parse!
end

Instance Method Details

#runObject

Runs the CLI



16
17
18
19
20
21
22
23
# File 'lib/github_polyglot/cli.rb', line 16

def run
  Dotenv.load

  token = ENV.fetch(GithubPolyglot::TOKEN_ENV_VAR, nil)
  token = nil if token&.empty?
  @polyglot = GithubPolyglot.new(username: @username, token: token)
  output_format
end