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
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ jobs:
ruby-version: '3.1'
bundler-cache: true

- name: Generate all subjects
run: bundle exec run examples regen
- name: Run shellcheck tests
run: bundle exec run shellcheck

- name: Run shfmt tests
run: bundle exec run shfmt
31 changes: 29 additions & 2 deletions Runfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ end

help "Run shellcheck on all examples"
action :shellcheck do
allowed_skips = 1
Example.executables.each do |example|
if File.exist? example
success = system "shellcheck #{example}"
Expand All @@ -29,15 +30,26 @@ action :shellcheck do
exit 1 unless success
else
say "- skip !txtcyn!#{example}"
allowed_skips -= 1
if allowed_skips < 0
say "- aborted: too many skips"
exit 1
end
end
end
end

help "Run shfmt checks on all examples"
action :shfmt do
allowed_skips = 2
Example.executables.each do |example|
if example == 'examples/heredoc/cli' || !File.exist?(example)
say "- skip !txtcyn!#{example}"
allowed_skips -= 1
if allowed_skips < 0
say "- aborted: too many skips"
exit 1
end
next
end

Expand All @@ -58,9 +70,22 @@ action :changelog do
File.write "CHANGELOG.md", File.read("CHANGELOG.md").gsub('repeatableflags', 'repeatable flags')
end

command :examples

help "Regenerate example scripts"
action :regen do
# Patch the PATH to allow the extensible example to run properly
ENV['PATH']="#{Dir.pwd}/examples/extensible:#{ENV['PATH']}"
Example.all.each do |example|
say example.dir
Dir.chdir example.dir do
system 'bash test.sh >/dev/null 2>&1'
end
end
end

help "Append the content of bashly.yml to all example READMEs"
action :examples do
# Disable color output (for the color examples)
action :readme do
ENV['NO_COLOR']='1'

# Patch the PATH to allow the extensible example to run properly
Expand All @@ -71,5 +96,7 @@ action :examples do
end
end

endcommand

require_relative 'helpers/release'
require './debug.rb' if File.exist? 'debug.rb'
3 changes: 0 additions & 3 deletions examples/custom-strings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ usage: download SOURCE [OPTIONS]
download - Sample minimal application with custom strings

== Usage ==

download SOURCE [OPTIONS]
download --help | -h
download --version | -v

== Options ==

--help, -h
Show this helpful help

Expand All @@ -98,7 +96,6 @@ download - Sample minimal application with custom strings
Target directory

== Arguments ==

SOURCE
URL to download from

Expand Down