1-
21# ' New command argument
32# '
43# ' Make a new [scribeArg] object
1312# ' @family scribe
1413# ' @export
1514new_arg <- function (
16- aliases = " " ,
17- action = arg_actions(),
18- default = NULL ,
19- convert = scribe_convert(),
20- n = NA_integer_ ,
21- info = NULL ,
22- options = list (),
23- stop = c(" none" , " hard" , " soft" ),
24- execute = invisible
15+ aliases = " " ,
16+ action = arg_actions(),
17+ default = NULL ,
18+ convert = scribe_convert(),
19+ n = NA_integer_ ,
20+ info = NULL ,
21+ options = list (),
22+ stop = c(" none" , " hard" , " soft" ),
23+ execute = invisible
2524) {
2625 scribeArg $ new(
2726 aliases = aliases ,
28- action = action ,
27+ action = action ,
2928 default = default ,
3029 convert = convert ,
31- n = n ,
32- info = info ,
30+ n = n ,
31+ info = info ,
3332 options = options ,
34- stop = stop ,
33+ stop = stop ,
3534 execute = execute
3635 )
3736}
@@ -48,7 +47,7 @@ scribe_help_arg <- function() {
4847 execute = function (self , ca ) {
4948 if (isTRUE(self $ get_value())) {
5049 ca $ help()
51- return ( exit() )
50+ exit()
5251 }
5352 }
5453 )
@@ -68,29 +67,28 @@ scribe_version_arg <- function() {
6867 if (isTRUE(self $ get_value())) {
6968 .Deprecated(" For {scribe} package version, use ---version instead" )
7069 ca $ version()
71- return ( exit() )
70+ exit()
7271 }
7372 }
7473 )
7574}
7675
7776# wrappers ----------------------------------------------------------------
7877
79- # nolint next: cyclocomp_linter.
8078arg_initialize <- function (
81- self ,
82- aliases = " " ,
83- action = arg_actions(),
84- default = NULL ,
85- convert = scribe_convert(),
86- n = NA_integer_ ,
87- info = NA_character_ ,
88- options = list (),
89- stop = c(" none" , " hard" , " soft" ),
90- execute = invisible
79+ self ,
80+ aliases = " " ,
81+ action = arg_actions(),
82+ default = NULL ,
83+ convert = scribe_convert(),
84+ n = NA_integer_ ,
85+ info = NA_character_ ,
86+ options = list (),
87+ stop = c(" none" , " hard" , " soft" ),
88+ execute = invisible
9189) {
92- action <- match.arg(action , arg_actions())
93- info <- info %|| % NA_character_
90+ action <- match.arg(action , arg_actions())
91+ info <- info %|| % NA_character_
9492 options <- options %|| % list ()
9593
9694 if (action == " default" ) {
@@ -314,7 +312,7 @@ arg_get_help <- function(self) {
314312 list = {
315313 left <- paste(
316314 to_string(self $ get_aliases(), sep = " , " ),
317- sprintf(" [%s]" , if (self $ n == 1 ) " ARG" else sprintf(" ..%i" , self $ n ))
315+ sprintf(" [%s]" , if (self $ n == 1 ) " ARG" else sprintf(" ..%i" , self $ n ))
318316 )
319317
320318 right <- self $ info
@@ -374,7 +372,7 @@ arg_get_name <- function(self, clean = TRUE) {
374372 nm
375373}
376374
377- arg_get_action <- function (self ) {
375+ arg_get_action <- function (self ) {
378376 self $ action %|| % character ()
379377}
380378
@@ -400,7 +398,6 @@ arg_is_resolved <- function(self) {
400398
401399# internal ----------------------------------------------------------------
402400
403- # nolint next: cyclocomp_linter.
404401arg_parse_value <- function (self , ca ) {
405402 default <-
406403 if (is_arg(self $ default )) {
@@ -508,7 +505,7 @@ is_arg <- function(x) {
508505 methods :: is(x , " scribeArg" )
509506}
510507
511- ARG_PAT <- " ^-[a-z]$|^---?[a-z]+$|^--?[a-z](+[-]?[a-z]+)+$" # nolint: object_name_linter, line_length_linter.
508+ ARG_PAT <- " ^-[a-z]$|^---?[a-z]+$|^--?[a-z](+[-]?[a-z]+)+$" # nolint: object_name_linter, line_length_linter.
512509
513510arg_actions <- function () {
514511 c(" default" , " list" , " flag" , " dots" )
0 commit comments