Giter VIP home page Giter VIP logo

Comments (2)

tomeichlersmith avatar tomeichlersmith commented on June 10, 2024

I'm going to close this now. After some investigation, the generated code by argc is not posix-sh compliant and the project is not very focused on generating posix-sh compliant code and instead focused on having argc available to do the argument handling. This is a reasonable choice from my perspective, but makes it a bad fit for this project.

from denv.

tomeichlersmith avatar tomeichlersmith commented on June 10, 2024
tom@nixos:~/code/denv/argc-investigation$ ./argc --argc-version
argc 1.17.0
tom@nixos:~/code/denv/argc-investigation$ cat denv-mimic
#!/bin/sh

# @cmd
config() {
  :
}

# @cmd
init() {
  :
}
tom@nixos:~/code/denv/argc-investigation$ ./argc --argc-build denv-mimic > denv-mimic-cli 
tom@nixos:~/code/denv$ shellcheck argc-investigation/denv-mimic-cli > shellcheck.log

shellcheck.log


In argc-investigation/denv-mimic-cli line 18:
    if [[ "$1" == "___internal___" ]]; then
       ^----------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In argc-investigation/denv-mimic-cli line 21:
    argc__args=("$(basename "$0" .sh)" "$@")
               ^---------------------------^ SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 22:
    argc__positionals=()
                      ^-- SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 25:
    _argc_tools=()
                ^-- SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 27:
    if [ -n "$argc__fn" ]; then
             ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    if [ -n "${argc__fn}" ]; then


In argc-investigation/denv-mimic-cli line 28:
        $argc__fn "${argc__positionals[@]}"
        ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                   ^---------------------^ SC3054 (warning): In POSIX sh, array references are undefined.

Did you mean: 
        ${argc__fn} "${argc__positionals[@]}"


In argc-investigation/denv-mimic-cli line 49:
    local _argc_key _argc_action
    ^--------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 50:
    local _argc_subcmds="config, init"
    ^-----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 51:
    while [[ $_argc_index -lt $_argc_len ]]; do
          ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.
             ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    while [[ ${_argc_index} -lt ${_argc_len} ]]; do


In argc-investigation/denv-mimic-cli line 52:
        _argc_item="${argc__args[_argc_index]}"
                    ^------------------------^ SC3054 (warning): In POSIX sh, array references are undefined.


In argc-investigation/denv-mimic-cli line 54:
        case "$_argc_key" in
              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        case "${_argc_key}" in


In argc-investigation/denv-mimic-cli line 63:
            argc__positionals+=("${argc__args[@]:$((_argc_index + 1))}")
            ^---------------^ SC3024 (warning): In POSIX sh, += is undefined.
                               ^-- SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 64:
            _argc_index=$_argc_len
                        ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            _argc_index=${_argc_len}


In argc-investigation/denv-mimic-cli line 78:
            local help_arg="${argc__args[$((_argc_index + 1))]}"
            ^------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
                            ^-- SC3054 (warning): In POSIX sh, array references are undefined.


In argc-investigation/denv-mimic-cli line 79:
            case "$help_arg" in
                  ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            case "${help_arg}" in


In argc-investigation/denv-mimic-cli line 90:
                _argc_die "error: invalid value \`$help_arg\` for \`<command>\`"$'\n'"  [possible values: $_argc_subcmds]"
                                                  ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                                                                                ^---^ SC3003 (warning): In POSIX sh, $'..' is undefined.
                                                                                                          ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
                _argc_die "error: invalid value \`${help_arg}\` for \`<command>\`"$'\n'"  [possible values: ${_argc_subcmds}]"


In argc-investigation/denv-mimic-cli line 95:
            _argc_die "error: \`denv-mimic\` requires a subcommand but one was not provided"$'\n'"  [subcommands: $_argc_subcmds]"
                                                                                            ^---^ SC3003 (warning): In POSIX sh, $'..' is undefined.
                                                                                                                  ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            _argc_die "error: \`denv-mimic\` requires a subcommand but one was not provided"$'\n'"  [subcommands: ${_argc_subcmds}]"


In argc-investigation/denv-mimic-cli line 99:
    if [[ -n "$_argc_action" ]]; then
       ^----------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.
              ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    if [[ -n "${_argc_action}" ]]; then


In argc-investigation/denv-mimic-cli line 100:
        $_argc_action
        ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        ${_argc_action}


In argc-investigation/denv-mimic-cli line 114:
    local _argc_key _argc_action
    ^--------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 115:
    local _argc_subcmds=""
    ^-----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 116:
    while [[ $_argc_index -lt $_argc_len ]]; do
          ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.
             ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    while [[ ${_argc_index} -lt ${_argc_len} ]]; do


In argc-investigation/denv-mimic-cli line 117:
        _argc_item="${argc__args[_argc_index]}"
                    ^------------------------^ SC3054 (warning): In POSIX sh, array references are undefined.


In argc-investigation/denv-mimic-cli line 119:
        case "$_argc_key" in
              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        case "${_argc_key}" in


In argc-investigation/denv-mimic-cli line 125:
            argc__positionals+=("${argc__args[@]:$((_argc_index + 1))}")
            ^---------------^ SC3024 (warning): In POSIX sh, += is undefined.
                               ^-- SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 126:
            _argc_index=$_argc_len
                        ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            _argc_index=${_argc_len}


In argc-investigation/denv-mimic-cli line 130:
            argc__positionals+=("$_argc_item")
            ^---------------^ SC3024 (warning): In POSIX sh, += is undefined.
                               ^-------------^ SC3030 (warning): In POSIX sh, arrays are undefined.
                                 ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            argc__positionals+=("${_argc_item}")


In argc-investigation/denv-mimic-cli line 135:
    if [[ -n "$_argc_action" ]]; then
       ^----------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.
              ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    if [[ -n "${_argc_action}" ]]; then


In argc-investigation/denv-mimic-cli line 136:
        $_argc_action
        ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        ${_argc_action}


In argc-investigation/denv-mimic-cli line 139:
        if [[ "${argc__positionals[0]}" == "help" ]] && [[ "${#argc__positionals[@]}" -eq 1 ]]; then
           ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.
               ^---------------------^ SC3054 (warning): In POSIX sh, array references are undefined.
                                                        ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In argc-investigation/denv-mimic-cli line 153:
    local _argc_key _argc_action
    ^--------------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 154:
    local _argc_subcmds=""
    ^-----------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In argc-investigation/denv-mimic-cli line 155:
    while [[ $_argc_index -lt $_argc_len ]]; do
          ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.
             ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    while [[ ${_argc_index} -lt ${_argc_len} ]]; do


In argc-investigation/denv-mimic-cli line 156:
        _argc_item="${argc__args[_argc_index]}"
                    ^------------------------^ SC3054 (warning): In POSIX sh, array references are undefined.


In argc-investigation/denv-mimic-cli line 158:
        case "$_argc_key" in
              ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        case "${_argc_key}" in


In argc-investigation/denv-mimic-cli line 164:
            argc__positionals+=("${argc__args[@]:$((_argc_index + 1))}")
            ^---------------^ SC3024 (warning): In POSIX sh, += is undefined.
                               ^-- SC3030 (warning): In POSIX sh, arrays are undefined.


In argc-investigation/denv-mimic-cli line 165:
            _argc_index=$_argc_len
                        ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            _argc_index=${_argc_len}


In argc-investigation/denv-mimic-cli line 169:
            argc__positionals+=("$_argc_item")
            ^---------------^ SC3024 (warning): In POSIX sh, += is undefined.
                               ^-------------^ SC3030 (warning): In POSIX sh, arrays are undefined.
                                 ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            argc__positionals+=("${_argc_item}")


In argc-investigation/denv-mimic-cli line 174:
    if [[ -n "$_argc_action" ]]; then
       ^----------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.
              ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
    if [[ -n "${_argc_action}" ]]; then


In argc-investigation/denv-mimic-cli line 175:
        $_argc_action
        ^-----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        ${_argc_action}


In argc-investigation/denv-mimic-cli line 178:
        if [[ "${argc__positionals[0]}" == "help" ]] && [[ "${#argc__positionals[@]}" -eq 1 ]]; then
           ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.
               ^---------------------^ SC3054 (warning): In POSIX sh, array references are undefined.
                                                        ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In argc-investigation/denv-mimic-cli line 185:
    if [[ $# -eq 0 ]]; then
       ^------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3003 -- In POSIX sh, $'..' is undefined.
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.
  https://www.shellcheck.net/wiki/SC3024 -- In POSIX sh, += is undefined.

from denv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.