Skip to content

Commit

Permalink
align command arg method args (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed May 25, 2024
1 parent dfcbb40 commit ed4a64f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
22 changes: 13 additions & 9 deletions R/class-command-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,13 @@ scribeCommandArgs$methods(

add_argument = function(
...,
action = arg_actions(),
options = NULL,
convert = scribe_convert(),
action = arg_actions(),
default = NULL,
n = NA_integer_,
info = NULL,
convert = scribe_convert(),
n = NA_integer_,
info = NULL,
options = list(),
stop = c("none", "hard", "soft"),
execute = invisible
) {
"Add a \\link{scribeArg} to \\code{args}
Expand All @@ -220,17 +221,20 @@ scribeCommandArgs$methods(
all other arguments are ignored. Note that only the first value
(\\link{..1}) is used.}
\\item{\\code{action}, \\code{options}, \\code{convet}, \\code{default},
\\code{n}, \\code{info}}{See \\code{\\link[=new_arg]{new_arg()}}}
\\code{n}, \\code{info}, \\code{stop}, \\code{execute}}{See
\\code{\\link[=new_arg]{new_arg()}}}
}"
ca_add_argument(
self = .self,
...,
action = action,
options = options,
convert = convert,
default = default,
convert = convert,
n = n,
info = info
info = info,
options = options,
stop = stop,
execute = execute
)
},

Expand Down
32 changes: 16 additions & 16 deletions R/command-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ command_args <- function(

ca_initialize <- function(
self,
input = NULL,
input = "",
include = c("help", "version", NA_character_),
supers = include
) {
Expand Down Expand Up @@ -97,7 +97,7 @@ ca_initialize <- function(
invisible(self)
}

ca_show <- function(self, all_values = FALSE, ...) {
ca_show <- function(self, ...) {
print_line("Initial call: ", to_string(self$get_input()))

if (!self$resolved) {
Expand Down Expand Up @@ -286,7 +286,7 @@ ca_get_values <- function(
values
}

ca_set_values <- function(self, i = NULL, value) {
ca_set_values <- function(self, i = TRUE, value) {
stopifnot(length(i) == 1)

if (is.null(value)) {
Expand Down Expand Up @@ -316,13 +316,13 @@ ca_get_args <- function(self, included = TRUE, super = FALSE) {
ca_add_argument <- function(
self,
...,
n = NA_integer_,
action = NULL,
convert = scribe_convert(),
options = NULL,
action = arg_actions(),
default = NULL,
info = NULL,
stop = "none",
convert = scribe_convert(),
n = NA_integer_,
info = NULL,
options = list(),
stop = c("none", "hard", "soft"),
execute = invisible
) {
if (is_arg(..1)) {
Expand All @@ -343,13 +343,13 @@ ca_add_argument <- function(

arg <- new_arg(
aliases = aliases,
action = action,
options = options,
convert = convert,
action = action,
default = default,
info = info,
stop = stop,
n = as.integer(n),
convert = convert,
n = as.integer(n),
info = info,
options = options,
stop = stop,
execute = execute
)
}
Expand Down Expand Up @@ -391,7 +391,7 @@ ca_set_example <- function(self, x = character(), comment = "", prefix = "$ ") {
invisible(self)
}

ca_add_example <- function(self, x = NULL, comment = "", prefix = "$ ") {
ca_add_example <- function(self, x, comment = "", prefix = "$ ") {
if (is.null(x)) {
return(invisible(self))
}
Expand Down

0 comments on commit ed4a64f

Please sign in to comment.