Skip to content

Commit cc4db33

Browse files
committed
Update documentation for CLI Option and Plugin and setup .yardocopts
1 parent 0f55c1e commit cc4db33

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--no-private --protected exe/* lib/**/*.rb - CODE_OF_CONDUCT.md README.md LICENSE.txt

lib/git_commander/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def say(message)
4141
#
4242
# @param command [Command] the git-cmd command to parse the arguments for
4343
# @param arguments [Array] the command line arguments
44-
# @return options [Array] the GitCommander::Command options with values
44+
# @return [Array<GitCommander::Command::Option>] the available options with values
4545
def parse_command_options!(command, arguments)
4646
parser = configure_option_parser_for_command(command)
4747
parser.parse!(arguments)

lib/git_commander/command/option.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22

33
module GitCommander
44
class Command
5-
# @nodoc
5+
# @abstract Wraps [Command] arguments, flags, and switches in a generic
6+
# object to normalize their representation in the context of a
7+
# [Command].
68
class Option
79
attr_reader :default, :description, :name
810
attr_writer :value
911

12+
# Creates a [Option] object.
13+
#
14+
# @param name [String, Symbol] the name of the option, these are unique per [Command]
15+
# @param default [anything] the default value the option should have
16+
# @param description [String] a description of the option for display in
17+
# the [Command]'s help text
18+
# @param value [anything] a value for the option
1019
def initialize(name:, default: nil, description: nil, value: nil)
1120
@name = name.to_sym
1221
@default = default

lib/git_commander/plugin.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ module GitCommander
1111
# context. Plugins can define their own inline gems, and can define
1212
# additional Commands.
1313
#
14-
# @example Loadable Command file with native `git` plugin
15-
# # This is a unique example of using `plugin` without any options. It
16-
# # uses the `git` plugin provided natively with this gem. Most times you will
17-
# # use a path: "path/to/my/plugin", or url: "https://example.com/myplugin"
18-
# plugin :git
19-
# command :local_branches do |cmd|
20-
# git.branches.local.map(&:name)
21-
# end
14+
# @example A simple `git` plugin
15+
# require "git"
16+
# git_instance = Git.open(Dir.pwd, log: GitCommander.logger)
17+
# GitCommander::Plugin.new(:git, source_instance: git_instance)
2218
#
2319
class Plugin
2420
attr_accessor :executor, :name, :registry

0 commit comments

Comments
 (0)