Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AllCops:
TargetRubyVersion: 3.3
SuggestExtensions: false
Exclude:
- tmp/**/*
- dev/**/*
- spec/fixtures/**/*

Expand Down
4 changes: 2 additions & 2 deletions 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.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
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
% September 2026
% November 2026

NAME
==================================================
Expand Down
126 changes: 63 additions & 63 deletions lib/bashly/views/command/completion_script_fish.gtx
Original file line number Diff line number Diff line change
@@ -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)"'
> }
4 changes: 2 additions & 2 deletions schemas/settings.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion schemas/strings.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion spec/bashly/integration/completion_script_fish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions support/runfile/schema.runfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
4 changes: 2 additions & 2 deletions support/schema/settings.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading