Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Conversation

@asheiduk
Copy link
Contributor

If the first DEFINE is not DEFINE_boolean the shell prints an error message.
Using the example in the header of gitflow-shFlags:

./hello.sh: 359: [: -eq: unexpected operator
Hello, world.

This is triggered by

   if [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \
      -a  ${_flags_isNegate_} -eq ${FLAGS_TRUE} ]; then

where _flags_isNegate_ is not set and hence the shell reads -a -eq 0

This is masked because by the first DEFINE_boolean because _flags_define
does not unset the internal variable _flags_isNegate_ at the end and hence
the value spills over to the next invocation.

Currently all commands seems to define a boolean option first, so strictly
speaking gitflow is not affected.

Signed-off-by: Andreas Heiduk asheiduk@gmail.com

If the first DEFINE is not DEFINE_boolean the shell prints an error message.
Using the example in the header of gitflow-shFlags:

./hello.sh: 359: [: -eq: unexpected operator
Hello, world.

This is triggered by

       if [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \
          -a  ${_flags_isNegate_} -eq ${FLAGS_TRUE} ]; then

where `_flags_isNegate_` is not set and hence the shell reads `-a -eq 0`

This is masked because by the first DEFINE_boolean because `_flags_define`
does not unset the internal variable `_flags_isNegate_` at the end and hence
the value spills over to the next invocation.

Currently all commands seems to define a boolean option first, so strictly
speaking gitflow is not affected.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
@asheiduk
Copy link
Contributor Author

asheiduk commented May 25, 2017

@petervanderdoes
I see, that __flag_isNegate__ is an extension to the original shflags library and that there is a pending pull request which you might want to update too: kward/shflags#34

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
@petervanderdoes petervanderdoes added this to the 1.11.1 milestone May 27, 2017
@petervanderdoes
Copy link
Owner

Thank you for your contribution.

Set to be merged for the next release, available since 3b4740c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants