diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 1f9bc6ac..c2176ff7 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -48,15 +48,15 @@ jobs: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - # Rush needed for easy installation of check-jsonschema + # Rush needed for easy installation of jsonschema - name: Install rush run: curl -Ls http://get.dannyb.co/rush/setup | bash - name: Connect rush repo run: rush clone dannyben --shallow --default - - name: Install check-jsonschema - run: rush get check-jsonschema + - name: Install jsonschema + run: rush get jsonschema # libyaml needed for Ruby's YAML library - name: Install OS dependencies diff --git a/.rubocop.yml b/.rubocop.yml index 37a6af3f..28f87193 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,6 +11,7 @@ AllCops: TargetRubyVersion: 3.3 SuggestExtensions: false Exclude: + - tmp/**/* - dev/**/* - spec/fixtures/**/* diff --git a/examples/render-mandoc/docs/download.1 b/examples/render-mandoc/docs/download.1 index 129a58c3..a5fc515e 100644 --- a/examples/render-mandoc/docs/download.1 +++ b/examples/render-mandoc/docs/download.1 @@ -1,6 +1,6 @@ -.\" Automatically generated by Pandoc 3.9 +.\" Automatically generated by Pandoc 3.12 .\" -.TH "download" "1" "September 2026" "Version 0.1.0" "Sample application" +.TH "download" "1" "November 2026" "Version 0.1.0" "Sample application" .SH NAME \f[B]download\f[R] \- Sample application .SH SYNOPSIS diff --git a/examples/render-mandoc/docs/download.md b/examples/render-mandoc/docs/download.md index 4e416ab0..664dd66d 100644 --- a/examples/render-mandoc/docs/download.md +++ b/examples/render-mandoc/docs/download.md @@ -1,6 +1,6 @@ % download(1) Version 0.1.0 | Sample application % Lana Lang -% September 2026 +% November 2026 NAME ================================================== diff --git a/lib/bashly/views/command/completion_script_fish.gtx b/lib/bashly/views/command/completion_script_fish.gtx index f7fb4015..aa279f79 100644 --- a/lib/bashly/views/command/completion_script_fish.gtx +++ b/lib/bashly/views/command/completion_script_fish.gtx @@ -1,69 +1,69 @@ = view_marker > send_completions_fish() { -> echo $'function _{{ name.to_underscore }}_completions' -> echo $' set --local completion_tokens (commandline --current-process --tokenize --cut-at-cursor)' -> echo $' set --local completion_current (commandline --current-token --cut-at-cursor)' -> echo $' set --local completion_command $completion_tokens[1]' -> echo $' set --local completion_words' -> echo $'' -> echo $' if test (count $completion_tokens) -gt 1' -> echo $' set completion_words $completion_tokens[2..-1]' -> echo $' end' -> echo $'' -> echo $' set --local completion_response ($completion_command __complete $completion_words "$completion_current")' -> echo $' set --query completion_response[1]; or return' -> echo $'' -> echo $' set --local completion_directive $completion_response[-1]' -> echo $' set --local completion_options' -> echo $'' -> echo $' if string match --quiet --regex "^:options=" -- $completion_directive' -> echo $' set --erase completion_response[-1]' -> echo $' set completion_options (string split --no-empty , -- (string replace --regex "^:options=" "" -- $completion_directive))' -> echo $' end' -> echo $'' -> echo $' set --local completion_files false' -> echo $' set --local completion_directories false' -> echo $' set --local completion_no_space false' -> echo $'' -> echo $' for completion_option in $completion_options' -> echo $' switch $completion_option' -> echo $' case files' -> echo $' set completion_files true' -> echo $' case directories' -> echo $' set completion_directories true' -> echo $' case no-space' -> echo $' set completion_no_space true' -> echo $' end' -> echo $' end' -> echo $'' -> echo $' set --local completion_candidates $completion_response' -> echo $' set --local completion_paths' -> echo $'' -> echo $' if test $completion_files = true' -> echo $' set completion_paths (__fish_complete_path "$completion_current")' -> echo $' else if test $completion_directories = true' -> echo $' set completion_paths (__fish_complete_directories "$completion_current")' -> echo $' end' -> echo $'' -> echo $' # path candidates carry a tab-separated description, and older fish' -> echo $' # versions do not deduplicate candidates on their own' -> echo $' for completion_path in $completion_paths' +> printf '%s\n' $'function _{{ name.to_underscore }}_completions' +> printf '%s\n' $' set --local completion_tokens (commandline --current-process --tokenize --cut-at-cursor)' +> printf '%s\n' $' set --local completion_current (commandline --current-token --cut-at-cursor)' +> printf '%s\n' $' set --local completion_command $completion_tokens[1]' +> printf '%s\n' $' set --local completion_words' +> printf '%s\n' $'' +> printf '%s\n' $' if test (count $completion_tokens) -gt 1' +> printf '%s\n' $' set completion_words $completion_tokens[2..-1]' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' set --local completion_response ($completion_command __complete $completion_words "$completion_current")' +> printf '%s\n' $' set --query completion_response[1]; or return' +> printf '%s\n' $'' +> printf '%s\n' $' set --local completion_directive $completion_response[-1]' +> printf '%s\n' $' set --local completion_options' +> printf '%s\n' $'' +> printf '%s\n' $' if string match --quiet --regex "^:options=" -- $completion_directive' +> printf '%s\n' $' set --erase completion_response[-1]' +> printf '%s\n' $' set completion_options (string split --no-empty , -- (string replace --regex "^:options=" "" -- $completion_directive))' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' set --local completion_files false' +> printf '%s\n' $' set --local completion_directories false' +> printf '%s\n' $' set --local completion_no_space false' +> printf '%s\n' $'' +> printf '%s\n' $' for completion_option in $completion_options' +> printf '%s\n' $' switch $completion_option' +> printf '%s\n' $' case files' +> printf '%s\n' $' set completion_files true' +> printf '%s\n' $' case directories' +> printf '%s\n' $' set completion_directories true' +> printf '%s\n' $' case no-space' +> printf '%s\n' $' set completion_no_space true' +> printf '%s\n' $' end' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' set --local completion_candidates $completion_response' +> printf '%s\n' $' set --local completion_paths' +> printf '%s\n' $'' +> printf '%s\n' $' if test $completion_files = true' +> printf '%s\n' $' set completion_paths (__fish_complete_path "$completion_current")' +> printf '%s\n' $' else if test $completion_directories = true' +> printf '%s\n' $' set completion_paths (__fish_complete_directories "$completion_current")' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' # path candidates carry a tab-separated description, and older fish' +> printf '%s\n' $' # versions do not deduplicate candidates on their own' +> printf '%s\n' $' for completion_path in $completion_paths' > printf '%s\n' $' if not contains -- (string replace --regex \'\\t.*\' \'\' -- $completion_path) $completion_response' -> echo $' set --append completion_candidates $completion_path' -> echo $' end' -> echo $' end' -> echo $'' -> echo $' # fish has no no-space directive, but it appends a space only to a' -> echo $' # unique candidate, so a second candidate suppresses it' -> echo $' if test $completion_no_space = true; and test (count $completion_candidates) -eq 1' -> echo $' set --append completion_candidates "$completion_candidates[1] "' -> echo $' end' -> echo $'' -> echo $' if set --query completion_candidates[1]' +> printf '%s\n' $' set --append completion_candidates $completion_path' +> printf '%s\n' $' end' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' # fish has no no-space directive, but it appends a space only to a' +> printf '%s\n' $' # unique candidate, so a second candidate suppresses it' +> printf '%s\n' $' if test $completion_no_space = true; and test (count $completion_candidates) -eq 1' +> printf '%s\n' $' set --append completion_candidates "$completion_candidates[1] "' +> printf '%s\n' $' end' +> printf '%s\n' $'' +> printf '%s\n' $' if set --query completion_candidates[1]' > printf '%s\n' $' printf \'%s\\n\' $completion_candidates' -> echo $' end' -> echo $'end' -> echo $'' -> echo $'complete --command {{ name }} --no-files --arguments "(_{{ name.to_underscore }}_completions)"' +> printf '%s\n' $' end' +> printf '%s\n' $'end' +> printf '%s\n' $'' +> printf '%s\n' $'complete --command {{ name }} --no-files --arguments "(_{{ name.to_underscore }}_completions)"' > } diff --git a/schemas/settings.json b/schemas/settings.json index 792a7035..f45132c9 100644 --- a/schemas/settings.json +++ b/schemas/settings.json @@ -1,5 +1,5 @@ { - "$schema": "https://json.schemastore.org/metaschema-draft-07-unofficial-strict.json", + "$schema": "http://json-schema.org/draft-07/schema", "definitions": { "color": { "oneOf": [ @@ -202,7 +202,7 @@ }, { "type": "string", - "pattern": "^(minimal|full|(bash|fish|zsh)(\\s*,\\s*(bash|fish|zsh))*)$" + "pattern": "^(minimal|full|(bash|zsh|fish)(\\s*,\\s*(bash|zsh|fish))*)$" } ], "default": null diff --git a/schemas/strings.json b/schemas/strings.json index d826d535..8f67ed16 100644 --- a/schemas/strings.json +++ b/schemas/strings.json @@ -1,5 +1,5 @@ { - "$schema": "https://json.schemastore.org/metaschema-draft-07-unofficial-strict.json", + "$schema": "http://json-schema.org/draft-07/schema", "title": "strings", "description": "Strings of the generated script\nhttps://bashly.dev/advanced/strings/#custom-strings", "type": "object", diff --git a/spec/bashly/integration/completion_script_fish_spec.rb b/spec/bashly/integration/completion_script_fish_spec.rb index c73e3ff3..4c76d14f 100644 --- a/spec/bashly/integration/completion_script_fish_spec.rb +++ b/spec/bashly/integration/completion_script_fish_spec.rb @@ -37,7 +37,7 @@ def complete_with_fish(*words) expect(status).to be_success expect(stderr).to be_empty expect(stdout).to start_with "function _cli_completions\n" - expect(stdout).to end_with %(complete --command cli --no-files --arguments "(_cli_completions)"\n) + expect(stdout).to end_with %[complete --command cli --no-files --arguments "(_cli_completions)"\n] end it 'completes commands' do diff --git a/support/runfile/schema.runfile b/support/runfile/schema.runfile index fc874372..bda23e10 100644 --- a/support/runfile/schema.runfile +++ b/support/runfile/schema.runfile @@ -116,19 +116,20 @@ helpers do say "\ngub`Invalid files PASS`" end + # JSON Schema CLI: https://github.com/sourcemeta/jsonschema def schema_check(file, schema = 'bashly') - command = "check-jsonschema --schemafile schemas/#{schema}.json #{file}" - say "\nnb`$ check-jsonschema` [m`#{schema}`] bb`#{file}`" + command = "jsonschema validate schemas/#{schema}.json #{file}" + say "\nnb`$ jsonschema validate` [m`#{schema}`] bb`#{file}`" success = system command abort 'Failed' unless success end def schema_anticheck(file, schema = 'bashly') - command = "check-jsonschema --schemafile schemas/#{schema}.json #{file}" - say "\nnb`$ check-jsonschema` [m`#{schema}`] bb`#{file}`" + command = "jsonschema validate schemas/#{schema}.json #{file}" + say "\nnb`$ jsonschema validate` [m`#{schema}`] bb`#{file}`" success = system "#{command}" abort 'Failed' if success end -end \ No newline at end of file +end diff --git a/support/schema/settings.yml b/support/schema/settings.yml index 02abe45f..48f9035f 100644 --- a/support/schema/settings.yml +++ b/support/schema/settings.yml @@ -1,4 +1,4 @@ -$schema: https://json.schemastore.org/metaschema-draft-07-unofficial-strict.json +$schema: http://json-schema.org/draft-07/schema definitions: color: oneOf: @@ -179,7 +179,7 @@ properties: - type: "null" - const: false - type: string - pattern: '^(minimal|full|(bash|zsh)(\s*,\s*(bash|zsh))*)$' + pattern: '^(minimal|full|(bash|zsh|fish)(\s*,\s*(bash|zsh|fish))*)$' default: null enable_view_markers: title: enable_view_markers