You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, _just_commands_from_file parses bash files to get the targets and help in one go and stored in an array. From here on all of just's logic uses this JUST_HELP_SEPARATOR and parses this one array accordingly, adding addition complicated logic that is unneeded.
I propose a new pattern that instead of setting parsed_help_a, it instead sets two arrays right away, parsed_commands_a and parsed_help_a, thus simplifying the rest of just
The awk code could even be modified (add to the end) to do something like:
Before:
target1 #@#Target1 help
target2 #@#Target2 help
After
target1
Target1 help
target2
Target2 help
By adding s|#@#(.*)|\n\1| in non-global, which would theoretically allow for a comment to contain #@# but not a target.
The text was updated successfully, but these errors were encountered:
sed -nE ':combine
# These next 5 lines combine lines ending in \ and remove leading spaces on next line
/\\$/{
# Read and append next line
N
# If the pattern buffer matches the case pattern, ends in a
# \ and the comment continues on the next line, then combine
/^ *#? *[ ?*_0-9|a-zA-Z{}"'"'"'-]*\) *#.*\\\n *#/{
# Combine the two lines, removing the extra #, replacing it
# with a single space
s| *\\\n *# *| |
t combine
}
s|\\\n *||''
t combine
}
# Remove tabs
s|\t+| |g
s|^ *#? *([ ?*_0-9|a-zA-Z{}"'"'"'-]*[?*_0-9|a-zA-Z{}"'"'"'-]) *\) *# *(.*)|\1\t\2|
# If there is a match, process it
t process
# Else do not even print it. This replaces a grep
b noprint
:process
# Remove trailing spaces
s| +$||
:processloop
# Converts aaa|bbb|ccc @#@ blah to aaa @#@ blah\nbbb @#@ blah\n...
s/\|(.*\t(.*))/\t\2'$'\\\n''\1/
# Continue processing until no matches
t processloop
# Remove quotes
s/^["'"'"']([^\n]*)["'"'"']\t/\1\t/
s/\n["'"'"']([^\n]*)["'"'"']\t/\n\1\t/g
# Convert output to two lines per target
s/\t/\n/g
p
:noprint' {files}
The new just help (after https://github.com/VisionSystemsInc/vsi_common/tree/just_spaces) will print help by by plugin instead of as one long list, and lists like parsed_commands_a will only be used for tab complete and nothing else. So this may or may not change what needs to happen here
Currently,
_just_commands_from_file
parses bash files to get the targets and help in one go and stored in an array. From here on all of just's logic uses thisJUST_HELP_SEPARATOR
and parses this one array accordingly, adding addition complicated logic that is unneeded.I propose a new pattern that instead of setting
parsed_help_a
, it instead sets two arrays right away,parsed_commands_a
andparsed_help_a
, thus simplifying the rest ofjust
The awk code could even be modified (add to the end) to do something like:
Before:
After
By adding
s|#@#(.*)|\n\1|
in non-global, which would theoretically allow for a comment to contain#@#
but not a target.The text was updated successfully, but these errors were encountered: