Skip to content

Commit 5109f9d

Browse files
committed
comply with rubocop's Layout/LineLength
1 parent b5d39cc commit 5109f9d

File tree

6 files changed

+66
-29
lines changed

6 files changed

+66
-29
lines changed

.rubocop.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,27 @@ AllCops:
1414
# The `ConfigValidator` class is a DSL, give it some complexity leeway
1515
Metrics/AbcSize:
1616
Exclude:
17-
- lib/bashly/config_validator.rb
17+
- lib/bashly/config_validator.rb
1818

1919
# (same as previous rule)
2020
Metrics/CyclomaticComplexity:
2121
Exclude:
22-
- lib/bashly/config_validator.rb
22+
- lib/bashly/config_validator.rb
2323

2424
# (same as previous rule)
2525
Metrics/PerceivedComplexity:
2626
Exclude:
27-
- lib/bashly/config_validator.rb
27+
- lib/bashly/config_validator.rb
2828

2929
# (same as previous rule)
3030
Metrics/MethodLength:
3131
Exclude:
32-
- lib/bashly/config_validator.rb
32+
- lib/bashly/config_validator.rb
3333

3434
# Guard clauses are inconsistent in the case of `ConfigValidator`
3535
Style/GuardClause:
3636
Exclude:
37-
- lib/bashly/config_validator.rb
38-
39-
# Commands may include long lines
40-
Layout/LineLength:
41-
Exclude:
42-
- 'lib/bashly/commands/*'
37+
- lib/bashly/config_validator.rb
4338

4439
# Allow irregular filenames in some cases
4540
RSpec/FilePath:

lib/bashly/commands/add.rb

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,49 @@ class Add < Base
1616

1717
option '-f --force', 'Overwrite existing files'
1818

19-
param 'FORMAT', "Output format, can be one of:\n function : generate a function file to be included in your script.\n script : generate a standalone bash completions script.\n yaml : generate a yaml compatible with completely."
20-
param 'OUTPUT', "For the 'comp function' command: Name of the generated function.\nFor the 'comp script' or 'comp yaml' commands: path to output file.\nIn all cases, this is optional and will have sensible defaults."
19+
param 'FORMAT', <<~USAGE
20+
Output format, can be one of:
21+
function : generate a function file to be included in your script.
22+
script : generate a standalone bash completions script.
23+
yaml : generate a yaml compatible with completely.
24+
USAGE
25+
26+
param 'OUTPUT', <<~USAGE
27+
For the 'comp function' command: Name of the generated function.
28+
For the 'comp script' or 'comp yaml' commands: path to output file.
29+
In all cases, this is optional and will have sensible defaults.
30+
USAGE
31+
32+
command 'colors',
33+
'Add standard functions for printing colorful and formatted text to the ' \
34+
'lib directory.'
2135

22-
command 'colors', 'Add standard functions for printing colorful and formatted text to the lib directory.'
2336
command 'comp', 'Generate a bash completions script or function.'
2437
command 'config', 'Add standard functions for handling INI files to the lib directory.'
25-
command 'lib', 'Create the additional lib directory for additional user scripts. All *.sh scripts in this folder will be included in the final bash script.'
26-
command 'settings', 'Copy a sample settings.yml file to your project, allowing you to customize some bashly options.'
27-
command 'strings', 'Copy an additional configuration file to your project, allowing you to customize all the tips and error strings.'
38+
command 'lib',
39+
'Create the additional lib directory for additional user scripts. ' \
40+
'All *.sh scripts in this folder will be included in the final bash script.'
41+
42+
command 'settings',
43+
'Copy a sample settings.yml file to your project, ' \
44+
'allowing you to customize some bashly options.'
45+
46+
command 'strings',
47+
'Copy an additional configuration file to your project, ' \
48+
'allowing you to customize all the tips and error strings.'
49+
2850
command 'test', 'Add approval testing.'
2951
command 'validations', 'Add argument validation functions to the lib directory.'
3052
command 'yaml', 'Add standard functions for reading YAML files to the lib directory.'
31-
3253
example 'bashly add strings --force'
3354
example 'bashly add comp function'
3455
example 'bashly add comp script completions.bash'
3556

36-
environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
37-
environment 'BASHLY_LIB_DIR', 'The path to use for creating the library files, relative to the source dir [default: lib]'
57+
environment 'BASHLY_SOURCE_DIR',
58+
'The path containing the bashly configuration and source files [default: src]'
59+
60+
environment 'BASHLY_LIB_DIR',
61+
'The path to use for creating the library files, relative to the source dir [default: lib]'
3862

3963
attr_reader :skip_src_check
4064

@@ -98,7 +122,10 @@ def add_lib(name, *args)
98122

99123
def safe_write(path, content)
100124
if !skip_src_check && !Dir.exist?(Settings.source_dir)
101-
raise InitError, "Directory !txtgrn!#{Settings.source_dir}!txtrst! does not exist\nRun !txtpur!bashly init!txtrst! first"
125+
raise InitError, <<~ERROR
126+
Directory !txtgrn!#{Settings.source_dir}!txtrst! does not exist
127+
Run !txtpur!bashly init!txtrst! first
128+
ERROR
102129
end
103130

104131
if File.exist?(path) && !args['--force']

lib/bashly/commands/generate.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ class Generate < Base
1515
option '-r --wrap FUNCTION', 'Wrap the entire script in a function so it can also be sourced'
1616
option '-e --env ENV', 'Force the generation environment (see BASHLY_ENV)'
1717

18-
environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
18+
environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source ' \
19+
'files [default: src]'
20+
1921
environment 'BASHLY_TARGET_DIR', 'The path to use for creating the bash script [default: .]'
20-
environment 'BASHLY_LIB_DIR', 'The path to use for upgrading library files, relative to the source dir [default: lib]'
22+
environment 'BASHLY_LIB_DIR',
23+
'The path to use for upgrading library files, relative to the source dir [default: lib]'
24+
2125
environment 'BASHLY_STRICT', 'When not empty, enable bash strict mode (set -euo pipefail)'
22-
environment 'BASHLY_TAB_INDENT', 'When not empty, the generated script will use tab indentation instead of spaces (every 2 leading spaces will be converted to a tab character)'
26+
environment 'BASHLY_TAB_INDENT',
27+
'When not empty, the generated script will use tab indentation instead of spaces ' \
28+
'(every 2 leading spaces will be converted to a tab character)'
29+
2330
environment 'BASHLY_ENV', <<~HELP
2431
Set to 'production' or 'development':
2532
- production generate a smaller script, without file markers
@@ -103,7 +110,8 @@ def upgrade(existing_file, library_name, *args)
103110
if Library.exist? library_name
104111
upgrade! existing_file, library_name, *args
105112
else
106-
quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, unknown library '#{library_name}'"
113+
quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, ' \
114+
'unknown library '#{library_name}'"
107115
end
108116
end
109117

lib/bashly/commands/init.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ module Bashly
22
module Commands
33
class Init < Base
44
summary 'Initialize a new workspace'
5-
help 'This command will create the source folder, and place a template configuration file in it.'
5+
help 'This command will create the source folder, and place a template ' \
6+
'configuration file in it.'
67

78
usage 'bashly init [--minimal]'
89
usage 'bashly init (-h|--help)'
910

1011
option '-m --minimal', 'Use a minimal configuration file (without commands)'
1112

12-
environment 'BASHLY_SOURCE_DIR', 'The path to use for creating the configuration file [default: src]'
13+
environment 'BASHLY_SOURCE_DIR',
14+
'The path to use for creating the configuration file [default: src]'
1315

1416
def run
1517
if Dir.exist?(target_dir) && !Dir.empty?(target_dir)

lib/bashly/commands/preview.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ class Preview < Base
66
usage 'bashly preview'
77
usage 'bashly preview (-h|--help)'
88

9-
environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
9+
environment 'BASHLY_SOURCE_DIR',
10+
'The path containing the bashly configuration and source files [default: src]'
1011

1112
def run
1213
with_valid_config do

lib/bashly/commands/validate.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ class Validate < Base
66
usage 'bashly validate [--verbose]'
77
usage 'bashly validate (-h|--help)'
88

9-
option '-v --verbose', 'Show the bashly configuration file prior to validating. This is useful when using split config (import) since it will show the final compiled configuration.'
9+
option '-v --verbose',
10+
'Show the bashly configuration file prior to validating. ' \
11+
'This is useful when using split config (import) since it will show ' \
12+
'the final compiled configuration.'
1013

11-
environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
14+
environment 'BASHLY_SOURCE_DIR',
15+
'The path containing the bashly configuration and source files [default: src]'
1216

1317
def run
1418
if args['--verbose']

0 commit comments

Comments
 (0)