-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
Renderable#render_options
for argument/case.gtx
- Loading branch information
Showing
6 changed files
with
40 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
= view_marker | ||
|
||
condition = render_options[:index].zero? ? 'if' : 'elif' | ||
> {{ condition }} [[ -z ${args['{{ name }}']+x} ]]; then | ||
> args['{{ name }}']=$1 | ||
> shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
= view_marker | ||
|
||
condition = render_options[:index].zero? ? 'if' : 'elif' | ||
|
||
if render_options[:index] == 0 | ||
> escaped="$(printf '%q' "$1")" | ||
end | ||
|
||
> {{ condition }} [[ -z ${args['{{ name }}']+x} ]]; then | ||
if repeatable | ||
> args['{{ name }}']="$escaped" | ||
if unique | ||
> unique_lookup["{{ name }}:$escaped"]=1 | ||
> elif [[ -z "${unique_lookup["{{ name }}:$escaped"]:-}" ]]; then | ||
> args['{{ name }}']="${args['{{ name }}']} $escaped" | ||
> unique_lookup["{{ name }}:$escaped"]=1 | ||
else | ||
> else | ||
> args['{{ name }}']="${args['{{ name }}']} $escaped" | ||
end | ||
|
||
else | ||
> args['{{ name }}']="$1" | ||
|
||
end |
9 changes: 2 additions & 7 deletions
9
lib/bashly/views/command/parse_requirements_case_catch_all.gtx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 1 addition & 22 deletions
23
lib/bashly/views/command/parse_requirements_case_repeatable.gtx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters