-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement `envs` command to make easier debugging GH-755 and developing GH-853 * Rewrite the command with ruby, the pipeline_w much helps for daily use. So closes GH-825 for now
- Loading branch information
Showing
7 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# TODO: Extract to another repository for use of inheritance | ||
|
||
AllCops: | ||
TargetRubyVersion: 3.3 | ||
DisplayCopNames: true | ||
DisabledByDefault: true | ||
Exclude: | ||
- 'dependencies' | ||
- '.direnv' | ||
- 'result' | ||
- 'dist' | ||
NewCops: disable | ||
|
||
Security: | ||
Enabled: true | ||
|
||
Style/HashSyntax: | ||
Enabled: true | ||
|
||
Style/TrailingMethodEndStatement: | ||
Enabled: true | ||
|
||
Style/MethodDefParentheses: | ||
Enabled: true | ||
|
||
Style/TrailingCommaInBlockArgs: | ||
Enabled: true | ||
|
||
Style/StringLiterals: | ||
Enabled: true | ||
EnforcedStyle: 'single_quotes' | ||
|
||
Style/StringLiteralsInInterpolation: | ||
Enabled: true | ||
EnforcedStyle: 'single_quotes' | ||
|
||
Style/TopLevelMethodDefinition: | ||
Enabled: true | ||
|
||
Style/InPatternThen: | ||
Enabled: true | ||
|
||
Style/HashEachMethods: | ||
Enabled: true | ||
|
||
Style/QuotedSymbols: | ||
Enabled: true | ||
EnforcedStyle: 'single_quotes' | ||
|
||
Style/MultilineInPatternThen: | ||
Enabled: true | ||
|
||
Layout: | ||
Enabled: true | ||
|
||
Layout/TrailingEmptyLines: | ||
Enabled: true | ||
|
||
Layout/TrailingWhitespace: | ||
Enabled: true | ||
|
||
Layout/SpaceBeforeFirstArg: | ||
Enabled: true | ||
|
||
Layout/SpaceBeforeSemicolon: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideArrayPercentLiteral: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideBlockBraces: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideParens: | ||
Enabled: true | ||
|
||
Layout/SpaceInsidePercentLiteralDelimiters: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideRangeLiteral: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideReferenceBrackets: | ||
Enabled: true | ||
|
||
Layout/SpaceInsideStringInterpolation: | ||
Enabled: true | ||
|
||
Layout/SpaceAroundMethodCallOperator: | ||
Enabled: true | ||
|
||
Layout/SpaceAroundKeyword: | ||
Enabled: true | ||
|
||
Layout/ArgumentAlignment: | ||
Enabled: true | ||
|
||
Layout/CaseIndentation: | ||
Enabled: true | ||
|
||
Layout/SpaceInLambdaLiteral: | ||
Enabled: true | ||
EnforcedStyle: require_space | ||
|
||
Layout/SpaceBeforeBlockBraces: | ||
Enabled: true | ||
|
||
Naming/MethodName: | ||
Enabled: true | ||
|
||
Naming/FileName: | ||
Enabled: true | ||
|
||
Naming/ConstantName: | ||
Enabled: true | ||
|
||
Naming/ClassAndModuleCamelCase: | ||
Enabled: true | ||
|
||
Naming/BlockParameterName: | ||
Enabled: true | ||
|
||
Naming/HeredocDelimiterCase: | ||
Enabled: true | ||
|
||
Bundler: | ||
Enabled: true | ||
|
||
Bundler/OrderedGems: | ||
Enabled: false | ||
|
||
Gemspec: | ||
Enabled: true | ||
|
||
Gemspec/OrderedDependencies: | ||
Enabled: false | ||
|
||
Lint: | ||
Enabled: true | ||
|
||
Lint/InheritException: | ||
Enabled: false | ||
|
||
Lint/RedundantStringCoercion: | ||
Enabled: false | ||
|
||
Lint/UnusedMethodArgument: | ||
Enabled: false | ||
|
||
Lint/AssignmentInCondition: | ||
Enabled: false | ||
|
||
Lint/RescueException: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,7 @@ | |
p | ||
g | ||
walk | ||
envs | ||
ir | ||
updeps | ||
bench_shells | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ pkgs, ... }: | ||
pkgs.writeShellApplication rec { | ||
name = "envs"; | ||
text = builtins.readFile ./${name}.bash; | ||
runtimeInputs = with pkgs; [ | ||
fzf | ||
ruby_3_3 # pkgs.writers.writeRuby and writeRubyBin does not fit | ||
]; | ||
runtimeEnv = { | ||
RUBY_SCRIPT_PATH = ./${name}.rb; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby -w "$RUBY_SCRIPT_PATH" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'open3' | ||
|
||
shortner = -> str { | ||
limit = 70 | ||
length = str.size | ||
str.slice(...limit).gsub("\n", ' ') + (length > limit ? '...' : '') | ||
} | ||
|
||
envs = ENV.sort.map { |k, v| "#{k}=#{shortner.(v)}" } | ||
|
||
fzf_query = ARGV.first | ||
|
||
Open3.pipeline_w( | ||
%Q!fzf --delimiter '=' --nth '1' --query "#{fzf_query}"! | ||
) do |first_stdin, _wait_thrs| | ||
first_stdin.puts envs | ||
end |