Skip to content

Commit 3b264b4

Browse files
authored
Merge pull request #324 from DannyBen/update/colsole
Update colsole to >= 0.8.1
2 parents 1d9519d + 9280835 commit 3b264b4

File tree

27 files changed

+78
-79
lines changed

27 files changed

+78
-79
lines changed

Runfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ action :shellcheck do
2525
Example.executables.each do |example|
2626
if File.exist? example
2727
success = system "shellcheck #{example}"
28-
color = success ? 'txtgrn' : 'txtred'
29-
say "- shellcheck !#{color}!#{example}"
28+
color = success ? 'g' : 'r'
29+
say "- shellcheck #{color}`#{example}`"
3030
exit 1 unless success
3131
else
32-
say "- skip !txtcyn!#{example}"
32+
say "- skip c`#{example}`"
3333
allowed_skips -= 1
3434
if allowed_skips < 0
3535
say "- aborted: too many skips"
@@ -44,7 +44,7 @@ action :shfmt do
4444
allowed_skips = 2
4545
Example.executables.each do |example|
4646
if example == 'examples/heredoc/cli' || !File.exist?(example)
47-
say "- skip !txtcyn!#{example}"
47+
say "- skip c`#{example}`"
4848
allowed_skips -= 1
4949
if allowed_skips < 0
5050
say "- aborted: too many skips"
@@ -54,8 +54,8 @@ action :shfmt do
5454
end
5555

5656
success = system "shfmt -d -i 2 -ci #{example}"
57-
color = success ? 'txtgrn' : 'txtred'
58-
say "- shfmt !#{color}!#{example}"
57+
color = success ? 'g' : 'r'
58+
say "- shfmt #{color}`#{example}`"
5959
exit 1 unless success
6060
end
6161
end

bashly.gemspec

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ Gem::Specification.new do |s|
1515
s.license = 'MIT'
1616
s.required_ruby_version = '>= 2.7.0'
1717

18-
# Sensitive dependencies, stricter version requirements
19-
s.add_runtime_dependency 'completely', '~> 0.5.1'
20-
s.add_runtime_dependency 'gtx', '~> 0.1.0'
21-
22-
s.add_runtime_dependency 'colsole', '~> 0.7'
18+
s.add_runtime_dependency 'colsole', '~> 0.8', '>= 0.8.1'
19+
s.add_runtime_dependency 'completely', '~> 0.5'
2320
s.add_runtime_dependency 'filewatcher', '~> 2.0'
21+
s.add_runtime_dependency 'gtx', '~> 0.1'
2422
s.add_runtime_dependency 'lp', '~> 0.2'
25-
s.add_runtime_dependency 'mister_bin', '~> 0.7.2'
23+
s.add_runtime_dependency 'mister_bin', '~> 0.7'
2624
s.add_runtime_dependency 'requires', '~> 1.0'
2725

2826
s.metadata = {

bin/bashly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ rescue Bashly::Interrupt
1212
exit 1
1313
rescue => e
1414
puts e.backtrace.reverse if ENV['DEBUG']
15-
say! "!undred!#{e.class}!txtrst!\n#{e.message}"
15+
say! "rib` #{e.class} `\n#{e.message}"
1616
exit 1
1717
end

helpers/checklist.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ def url_exist?(url)
1212
end
1313

1414
def run(text)
15-
say "!txtblu![....]!txtrst! #{text} "
15+
say "b`[....]` #{text} "
1616
if failed >= limit
1717
say ''
1818
return
1919
end
2020

2121
ok = yield
2222
if ok
23-
resay "!txtgrn![PASS]!txtrst! #{text}"
23+
say "g`[PASS]` #{text}", replace: true
2424
else
25-
resay "!txtred![FAIL]!txtrst! #{text}"
25+
say "r`[FAIL]` #{text}", replace: true
2626
@failed += 1
2727
end
2828
end

helpers/release.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
checklist = Checklist.new
77

8-
say "Checklist for version !txtgrn!#{version}!txtrst!"
8+
say "Checklist for version g`#{version}`"
99

1010
checklist.run 'git on master and clean' do
1111
`git status`.match(/On branch master.*nothing to commit/m)
@@ -68,6 +68,6 @@
6868
`curl -Ss https://raw.githubusercontent.com/DannyBen/bashly-book/master/retype.yml`.include? "label: v#{version}"
6969
end
7070

71-
color = checklist.failed.zero? ? '!bldgrn!' : '!bldred!'
72-
say " #{color}Done with #{checklist.failed} failed tasks"
71+
color = checklist.failed.zero? ? 'gb' : 'rb'
72+
say " #{color}`Done with #{checklist.failed} failed tasks`"
7373
end

lib/bashly/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CLI
77
def self.runner
88
runner = MisterBin::Runner.new version: Bashly::VERSION,
99
header: 'Bashly - Bash CLI Generator',
10-
footer: "Help: !txtpur!bashly COMMAND --help!txtrst!\nDocs: !undblu!https://bashly.dannyb.co"
10+
footer: "Help: m`bashly COMMAND --help`\nDocs: bu`https://bashly.dannyb.co`"
1111

1212
runner.route 'init', to: Commands::Init
1313
runner.route 'preview', to: Commands::Preview

lib/bashly/commands/add.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ def add_lib(name, *args)
124124
def safe_write(path, content)
125125
if !skip_src_check && !Dir.exist?(Settings.source_dir)
126126
raise InitError, <<~ERROR
127-
Directory !txtgrn!#{Settings.source_dir}!txtrst! does not exist
128-
Run !txtpur!bashly init!txtrst! first
127+
Directory g`#{Settings.source_dir}` does not exist
128+
Run m`bashly init` first
129129
ERROR
130130
end
131131

132132
if File.exist?(path) && !args['--force']
133-
say "!txtblu!skipped!txtrst! #{path} (exists)"
133+
say "b`skipped` #{path} (exists)"
134134
false
135135

136136
else
137137
File.deep_write path, content
138-
say "!txtgrn!created!txtrst! #{path}"
138+
say "g`created` #{path}"
139139
true
140140

141141
end

lib/bashly/commands/doc.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,35 @@ def show
3535
end
3636

3737
def show_key(key)
38-
say "!txtgrn!#{key}"
38+
say "g`#{key}`"
3939
say ''
4040
end
4141

4242
def show_url(url)
43-
say " See !undblu!#{url}"
43+
say " See bu`#{url}`"
4444
say ''
4545
end
4646

4747
def show_example(example)
4848
example = word_wrap " #{example}"
49-
example.gsub!(/^(\s*- )?(\s*\w+):/, '\1!txtblu!\2!txtrst!:')
50-
example.gsub!(/^(\s*- )/, '!txtylw!\1!txtrst!')
51-
example.gsub!(/^(\s*#.+)/, '!txtpur!\1!txtrst!')
49+
example.gsub!(/^(\s*- )?(\s*\w+):/, '\1b`\2`:')
50+
example.gsub!(/^(\s*- )/, 'y`\1`')
51+
example.gsub!(/^(\s*#.+)/, 'm`\1`')
5252
say example
5353
say ''
5454
end
5555

5656
def show_help(help)
5757
help = word_wrap " #{help}"
58-
help.gsub!(/`([^`]+)`/, '!txtgrn!\1!txtrst!')
58+
help.gsub!(/`([^`]+)`/, 'g`\1`')
5959
say help
6060
say ''
6161
end
6262

6363
def data
6464
return raw_data unless args['SEARCH']
6565

66-
result = raw_data.select { |k, _v| k.== args['SEARCH'] }
66+
result = raw_data.select { |k, _v| k == args['SEARCH'] }
6767
return result if result.any?
6868

6969
result = raw_data.select { |k, _v| k.include? args['SEARCH'] }

lib/bashly/commands/generate.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ def run
5252
private
5353

5454
def watch
55-
quiet_say "!txtgrn!watching!txtrst! #{Settings.source_dir}\n"
55+
quiet_say "g`watching` #{Settings.source_dir}\n"
5656

5757
Filewatcher.new([Settings.source_dir]).watch do
5858
reset
5959
generate
6060

6161
rescue Bashly::ConfigurationError => e
62-
say! "!undred!#{e.class}!txtrst!\n#{e.message}"
62+
say! "rib` #{e.class} `\n#{e.message}"
6363

6464
ensure
65-
quiet_say "!txtgrn!waiting\n"
65+
quiet_say "g`waiting`\n"
6666
end
6767
end
6868

6969
def generate
7070
with_valid_config do
71-
quiet_say 'creating !txtgrn!production!txtrst! version' if Settings.production?
71+
quiet_say 'creating g`production` version' if Settings.production?
7272
generate_all_files
73-
quiet_say "run !txtpur!#{master_script_path} --help!txtrst! to test your bash script" unless watching
73+
quiet_say "run m`#{master_script_path} --help` to test your bash script" unless watching
7474
end
7575
end
7676

@@ -110,7 +110,7 @@ def upgrade(existing_file, library_name, *args)
110110
if Library.exist? library_name
111111
upgrade! existing_file, library_name, *args
112112
else
113-
quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, " \
113+
quiet_say "r`warning` not upgrading c`#{existing_file}`, " \
114114
"unknown library '#{library_name}'"
115115
end
116116
end
@@ -121,14 +121,14 @@ def upgrade!(existing_file, library_name, *args)
121121

122122
if file
123123
File.deep_write file[:path], file[:content]
124-
quiet_say "!txtcyn!updated!txtrst! #{file[:path]}"
124+
quiet_say "c`updated` #{file[:path]}"
125125
else
126-
quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, path mismatch"
126+
quiet_say "r`warning` not upgrading c`#{existing_file}`, path mismatch"
127127
end
128128
end
129129

130130
def create_user_files
131-
quiet_say "creating user files in !txtgrn!#{Settings.source_dir}"
131+
quiet_say "creating user files in g`#{Settings.source_dir}`"
132132

133133
create_file "#{Settings.source_dir}/initialize.#{Settings.partials_extension}",
134134
command.render(:default_initialize_script)
@@ -156,17 +156,17 @@ def create_all_command_files
156156

157157
def create_file(file, content)
158158
if File.exist?(file) && !args['--force']
159-
quiet_say "!txtblu!skipped!txtrst! #{file} (exists)"
159+
quiet_say "b`skipped` #{file} (exists)"
160160
else
161161
File.deep_write file, content
162-
quiet_say "!txtgrn!created!txtrst! #{file}"
162+
quiet_say "g`created` #{file}"
163163
end
164164
end
165165

166166
def create_master_script
167167
File.write master_script_path, script.code(tab_indent: Settings.tab_indent)
168168
FileUtils.chmod '+x', master_script_path
169-
quiet_say "!txtgrn!created!txtrst! #{master_script_path}"
169+
quiet_say "g`created` #{master_script_path}"
170170
end
171171

172172
def script

lib/bashly/commands/init.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class Init < Base
1313

1414
def run
1515
if Dir.exist?(target_dir) && !Dir.empty?(target_dir)
16-
raise InitError, "Directory !txtgrn!#{target_dir}!txtrst! already exists and is not empty"
16+
raise InitError, "Directory g`#{target_dir}` already exists and is not empty"
1717
end
1818

1919
FileUtils.mkdir_p target_dir
2020
File.write "#{target_dir}/bashly.yml", yaml_content
21-
say "!txtgrn!created!txtrst! #{target_dir}/bashly.yml"
22-
say 'run !txtpur!bashly generate!txtrst! to create the bash script'
21+
say "g`created` #{target_dir}/bashly.yml"
22+
say 'run m`bashly generate` to create the bash script'
2323
end
2424

2525
private

0 commit comments

Comments
 (0)