Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move root variables from run() to initialize() #568

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.2
.\"
.TH "download" "1" "October 2024" "Version 0.1.0" "Sample application"
.TH "download" "1" "November 2024" "Version 0.1.0" "Sample application"
.SH NAME
\f[B]download\f[R] \- Sample application
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% download(1) Version 0.1.0 | Sample application
% Lana Lang
% October 2024
% November 2024

NAME
==================================================
Expand Down
2 changes: 1 addition & 1 deletion lib/bashly/views/command/function.gtx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= view_marker

> {{ function_name }}_command() {
= render(:variables).indent(2) if variables&.any?
= render(:variables).indent(2)
= load_user_file(filename).indent 2
> }
>
1 change: 1 addition & 0 deletions lib/bashly/views/command/initialize.gtx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

if root_command?
>
= render(:variables).indent(2)
= render(:environment_variables_default).indent 2
end

Expand Down
1 change: 0 additions & 1 deletion lib/bashly/views/command/run.gtx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
if has_unique_args_or_flags?
> declare -A unique_lookup=()
end
= render(:variables).indent(2) if variables&.any?
> normalize_input "$@"
> parse_requirements "${input[@]}"
if user_file_exist?('before')
Expand Down
10 changes: 6 additions & 4 deletions lib/bashly/views/command/variables.gtx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
= view_marker
if variables.any?
= view_marker

variables.each do |var|
= var.render(:definition)
end
variables.each do |var|
= var.render(:definition)
end
end
2 changes: 1 addition & 1 deletion spec/approvals/examples/render-mandoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ ISSUE TRACKER
AUTHORS
Lana Lang.

Version 0.1.0 October 2024 download(1)
Version 0.1.0 November 2024 download(1)