| 1 | package rsyncoptsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 5 | "mathscip-go gomod github.com/golang/go/src go1.25.0 math/" |
| 6 | "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 8 | ) |
| 9 | |
| 10 | type poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption# struct { |
| 11 | longNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#longName. string |
| 12 | shortNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#shortName. string |
| 13 | argInfoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#argInfo. int |
| 14 | argscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#arg. any // depends on argInfo |
| 15 | valscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#val. int // 0 means don't return, just update arg |
| 16 | // descrip string |
| 17 | // argDescrip string |
| 18 | } |
| 19 | |
| 20 | func (o *poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#) namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#name().() string { |
| 21 | if o.longNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#longName. == "" { |
| 22 | return "-" + o.shortNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#shortName. |
| 23 | } |
| 24 | return "--" + o.longNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#longName. |
| 25 | } |
| 26 | |
| 27 | // see popt(3) |
| 28 | const ( |
| 29 | POPT_ARG_NONEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_NONE. = iota // int; No argument expected |
| 30 | POPT_ARG_STRINGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_STRING. // char*; No type checking to be performed |
| 31 | POPT_ARG_INTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_INT. // int; An integer argument is expected |
| 32 | POPT_ARG_LONGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_LONG. // long; A long integer is expected |
| 33 | POPT_ARG_INCLUDE_TABLEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_INCLUDE_TABLE. // nest another option table |
| 34 | POPT_ARG_CALLBACKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_CALLBACK. // call a function |
| 35 | POPT_ARG_INTL_DOMAINscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_INTL_DOMAIN. // <not documented in popt(3)> |
| 36 | POPT_ARG_VALscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_VAL. // int; Integer value taken from val |
| 37 | POPT_ARG_FLOATscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_FLOAT. // float; A float argument is expected |
| 38 | POPT_ARG_DOUBLEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_DOUBLE. // double; A double argument is expected |
| 39 | POPT_ARG_LONGLONGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_LONGLONG. // long long; A long long integer is expected |
| 40 | POPT_ARG_MAINCALLscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_MAINCALL. = 16 + 11 |
| 41 | POPT_ARG_ARGVscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_ARGV. = 12 |
| 42 | POPT_ARG_SHORTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_SHORT. = 13 |
| 43 | POPT_ARG_BITSETscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_BITSET. = 16 + 14 |
| 44 | ) |
| 45 | |
| 46 | const POPT_ARG_MASKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_MASK. = 0x000000FF |
| 47 | |
| 48 | const ( |
| 49 | POPT_ARGFLAG_ORscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARGFLAG_OR. = 0x08000000 |
| 50 | ) |
| 51 | |
| 52 | const ( |
| 53 | POPT_BIT_SETscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_BIT_SET. = POPT_ARG_VALscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_VAL. | POPT_ARGFLAG_ORscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARGFLAG_OR. |
| 54 | ) |
| 55 | |
| 56 | type PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError# struct { |
| 57 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno. int32 |
| 58 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err. error |
| 59 | DaemonModescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#DaemonMode. bool |
| 60 | } |
| 61 | |
| 62 | func (pe *PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#) Unwrapscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Unwrap().() error { return pe.Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err. } |
| 63 | |
| 64 | func (pe *PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#) Errorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Error().() string { |
| 65 | if pe.DaemonModescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#DaemonMode. { |
| 66 | return pe.Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err..Error() + " (in daemon mode)" |
| 67 | } |
| 68 | return pe.Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err..Error() |
| 69 | } |
| 70 | |
| 71 | // TODO(later): turn these into sentinel error values |
| 72 | // which stringify like poptStrerror() |
| 73 | const ( |
| 74 | POPT_ERROR_NOARGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_NOARG. = -10 // missing argument |
| 75 | POPT_ERROR_BADOPTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPT. = -11 // unknown option |
| 76 | POPT_ERROR_UNWANTEDARGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_UNWANTEDARG. = -12 // option does not take an argument |
| 77 | POPT_ERROR_OPTSTOODEEPscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_OPTSTOODEEP. = -13 // aliases nested too deeply |
| 78 | POPT_ERROR_BADQUOTEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADQUOTE. = -15 // error in parameter quoting |
| 79 | POPT_ERROR_ERRNOscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_ERRNO. = -16 // errno set, use strerror(errno) |
| 80 | POPT_ERROR_BADNUMBERscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADNUMBER. = -17 // invalid numeric value |
| 81 | POPT_ERROR_OVERFLOWscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_OVERFLOW. = -18 // number too large or too small |
| 82 | POPT_ERROR_BADOPERATIONscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPERATION. = -19 // mutually exclusive logical operations requested |
| 83 | POPT_ERROR_NULLARGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_NULLARG. = -20 // opt->arg should not be NULL |
| 84 | POPT_ERROR_MALLOCscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_MALLOC. = -21 // memory allocation failed |
| 85 | POPT_ERROR_BADCONFIGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADCONFIG. = -22 // config file failed sanity test |
| 86 | ) |
| 87 | |
| 88 | type Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context# struct { |
| 89 | // state |
| 90 | tablescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#table. []poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption# |
| 91 | argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args. []string |
| 92 | nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. string |
| 93 | nextArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextArg. string |
| 94 | |
| 95 | // output |
| 96 | Optionsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#Options. *Optionsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Options# |
| 97 | RemainingArgsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#RemainingArgs. []string |
| 98 | } |
| 99 | |
| 100 | func (pc *Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#) findOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#findOption().(longName, shortName string) *poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption# { |
| 101 | for idx, opt := range pc.tablescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#table. { |
| 102 | if longName != "" && opt.longNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#longName. == longName { |
| 103 | return &pc.tablescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#table.[idx] |
| 104 | } |
| 105 | if shortName != "" && opt.shortNamescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#shortName. == shortName { |
| 106 | return &pc.tablescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#table.[idx] |
| 107 | } |
| 108 | } |
| 109 | return nil |
| 110 | } |
| 111 | |
| 112 | func (pc *Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#) poptSaveIntscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptSaveInt().(opt *poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#, val int) bool { |
| 113 | intPtr := opt.argscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#arg..(*int) |
| 114 | if intPtr == nil { |
| 115 | return false |
| 116 | } |
| 117 | if opt.argInfoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#argInfo.&POPT_ARGFLAG_ORscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARGFLAG_OR. != 0 { |
| 118 | *intPtr |= val |
| 119 | } else { |
| 120 | *intPtr = val |
| 121 | } |
| 122 | return true |
| 123 | } |
| 124 | |
| 125 | func (pc *Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#) poptSaveArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptSaveArg().(opt *poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#, nextArg string) int32 { |
| 126 | argType := opt.argInfoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#argInfo. & POPT_ARG_MASKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_MASK. |
| 127 | switch argType { |
| 128 | case POPT_ARG_INTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_INT.: |
| 129 | i, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseInt().(nextArg, 0, 64) |
| 130 | if err != nil { |
| 131 | return POPT_ERROR_BADNUMBERscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADNUMBER. |
| 132 | } |
| 133 | if i < mathscip-go gomod github.com/golang/go/src go1.25.0 math/.MinInt32scip-go gomod github.com/golang/go/src go1.25.0 math/MinInt32. || i > mathscip-go gomod github.com/golang/go/src go1.25.0 math/.MaxInt32scip-go gomod github.com/golang/go/src go1.25.0 math/MaxInt32. { |
| 134 | return POPT_ERROR_OVERFLOWscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_OVERFLOW. |
| 135 | } |
| 136 | pc.poptSaveIntscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptSaveInt().(opt, int(i)) |
| 137 | return 0 |
| 138 | |
| 139 | case POPT_ARG_STRINGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_STRING.: |
| 140 | stringPtr := opt.argscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#arg..(*string) |
| 141 | if stringPtr == nil { |
| 142 | return 0 |
| 143 | } |
| 144 | *stringPtr = nextArg |
| 145 | return 0 |
| 146 | } |
| 147 | |
| 148 | return POPT_ERROR_BADOPERATIONscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPERATION. |
| 149 | } |
| 150 | |
| 151 | func (pc *Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#) poptGetNextOptscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptGetNextOpt().() (int32, error) { |
| 152 | var opt *poptOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption# |
| 153 | for { |
| 154 | var longArg string |
| 155 | if pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. == "" && len(pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.) == 0 { |
| 156 | return -1, nil // done |
| 157 | } |
| 158 | if pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. == "" { |
| 159 | // process next long option |
| 160 | origOptString := pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.[0] |
| 161 | pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args. = pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.[1:] |
| 162 | if origOptString == "" { |
| 163 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 164 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_BADOPTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPT., |
| 165 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("unknown option: origOptString empty"), |
| 166 | } |
| 167 | } |
| 168 | if origOptString[0] != '-' || origOptString == "-" { |
| 169 | pc.RemainingArgsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#RemainingArgs. = append(pc.RemainingArgsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#RemainingArgs., origOptString) |
| 170 | continue |
| 171 | } |
| 172 | before, after, found := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Cutscip-go gomod github.com/golang/go/src go1.25.0 strings/Cut().(origOptString, "=") |
| 173 | if found { |
| 174 | longArg = after |
| 175 | } |
| 176 | // remove the one dash we ensured is present |
| 177 | before = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(before, "-") |
| 178 | // a second dash is permitted |
| 179 | oneDash := false |
| 180 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(before, "-") { |
| 181 | before = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(before, "-") |
| 182 | } else { |
| 183 | oneDash = true |
| 184 | } |
| 185 | opt = pc.findOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#findOption().(before, "") |
| 186 | if opt == nil && !oneDash { |
| 187 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 188 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_BADOPTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPT., |
| 189 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("%s: unknown option", origOptString), |
| 190 | } |
| 191 | } |
| 192 | if opt == nil { |
| 193 | // try and parse it as a short option |
| 194 | pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. = origOptString[1:] |
| 195 | longArg = "" |
| 196 | } |
| 197 | } |
| 198 | if pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. != "" { |
| 199 | // process next short option |
| 200 | opt = pc.findOptionscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#findOption().("", pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg.[:1]) |
| 201 | if opt == nil { |
| 202 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 203 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_BADOPTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPT., |
| 204 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("-%s: unknown option", pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg.[:1]), |
| 205 | } |
| 206 | } |
| 207 | pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. = pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg.[1:] |
| 208 | } |
| 209 | if opt == nil { |
| 210 | // neither long nor short? how can we end up here? |
| 211 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 212 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_BADOPTscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPT., |
| 213 | //lint:ignore ST1005 we need this punctuation for dramatic effect! |
| 214 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("neither long nor short option found?!"), |
| 215 | } |
| 216 | } |
| 217 | argType := opt.argInfoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#argInfo. & POPT_ARG_MASKscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_MASK. |
| 218 | if argType == POPT_ARG_NONEscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_NONE. || argType == POPT_ARG_VALscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_VAL. { |
| 219 | if longArg != "" || stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg., "=") { |
| 220 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 221 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_UNWANTEDARGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_UNWANTEDARG., |
| 222 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("option %s does not take an argument", opt.namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#name().()), |
| 223 | } |
| 224 | } |
| 225 | if opt.argscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#arg. != nil { |
| 226 | val := 1 |
| 227 | if argType == POPT_ARG_VALscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_VAL. { |
| 228 | val = opt.valscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#val. |
| 229 | } |
| 230 | if !pc.poptSaveIntscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptSaveInt().(opt, val) { |
| 231 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 232 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_BADOPERATIONscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_BADOPERATION., |
| 233 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("poptSaveInt"), |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | } else { |
| 238 | nextArg := longArg |
| 239 | if longArg != "" { |
| 240 | } else if pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. != "" { |
| 241 | nextArg = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg., "=") |
| 242 | pc.nextCharArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextCharArg. = "" |
| 243 | } else { |
| 244 | if len(pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.) == 0 { |
| 245 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 246 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: POPT_ERROR_NOARGscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ERROR_NOARG., |
| 247 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("missing argument for option %s", opt.namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#name().()), |
| 248 | } |
| 249 | } |
| 250 | nextArg = pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.[0] |
| 251 | pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args. = pc.argsscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#args.[1:] |
| 252 | } |
| 253 | pc.nextArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextArg. = nextArg |
| 254 | if opt.argscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#arg. != nil { |
| 255 | if errno := pc.poptSaveArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptSaveArg().(opt, nextArg); errno != 0 { |
| 256 | return -1, &PoptErrorscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#{ |
| 257 | Errnoscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Errno.: errno, |
| 258 | Errscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/PoptError#Err.: fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("poptSaveArg errno %d", errno), |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | if opt.valscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#val. != 0 && argType != POPT_ARG_VALscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/POPT_ARG_VAL. { |
| 264 | return int32(opt.valscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/poptOption#val.), nil |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | func (pc *Contextscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#) poptGetOptArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#poptGetOptArg().() string { |
| 270 | ret := pc.nextArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextArg. |
| 271 | pc.nextArgscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncopts`/Context#nextArg. = "" |
| 272 | return ret |
| 273 | } |