Class: Commitlint::Cli
- Inherits:
-
Object
- Object
- Commitlint::Cli
- Defined in:
- lib/commitlint/cli.rb
Overview
Cli class is responsible for handling command line arguments
Constant Summary collapse
- BANNER =
"Commintlint v\#{Commitlint::VERSION} - A CLI tool to lint commit messages with Conventional Commits.\n\nUsage: commitlint --message [commit_message | filepath]\n\nExamples:\n commitlint --message \"feat: add new feature\"\n commitlint --message \"./path/to/commit_msg\"\n commitlint --message \".git/COMMIT_EDITMSG\"\n\nOptions:\n".freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Cli
Returns a new instance of Cli.
21 22 23 24 25 26 27 |
# File 'lib/commitlint/cli.rb', line 21 def initialize(argv) @argv = argv = { message: nil, quiet: false } end |
Class Method Details
.start(argv) ⇒ Object
29 30 31 |
# File 'lib/commitlint/cli.rb', line 29 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/commitlint/cli.rb', line 33 def run @argv << "-h" if @argv.empty? return 0 if [:message].nil? = parse_input([:message]) linter = Linter.new(, output: ![:quite]) linter.lint! end |