mirror of
https://github.com/danbee/dotfiles-local
synced 2025-03-04 08:49:07 +00:00
Compare commits
No commits in common. "a8143ba0437894c622fff57d2c1257cd12effe26" and "72742bd18d1c2bd381e39177089f294f6e78914d" have entirely different histories.
a8143ba043
...
72742bd18d
@ -1,21 +0,0 @@
|
|||||||
class OS
|
|
||||||
ICONS = {
|
|
||||||
"Darwin" => "",
|
|
||||||
"Linux" => "",
|
|
||||||
"FreeBSD" => "",
|
|
||||||
}
|
|
||||||
|
|
||||||
def os
|
|
||||||
"#{icon} #{name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def name
|
|
||||||
@os ||= `uname -s`.strip
|
|
||||||
end
|
|
||||||
|
|
||||||
def icon
|
|
||||||
ICONS[name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
require_relative "tools/file"
|
|
||||||
require_relative "tools/icons"
|
|
||||||
|
|
||||||
class Tools
|
|
||||||
include ToolIcons
|
|
||||||
|
|
||||||
attr_reader :tools
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@tools = ToolsFile.new.tools
|
|
||||||
end
|
|
||||||
|
|
||||||
def list_tools
|
|
||||||
tools.sort.each do |tool, meta|
|
|
||||||
if available_tools.include?(tool)
|
|
||||||
puts "#{tool_icon(tool)}" \
|
|
||||||
"#{tool.ljust(max_length)} " \
|
|
||||||
"#{version(meta)}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def version(meta)
|
|
||||||
if installed?(meta)
|
|
||||||
"\e[37m#{meta[:version]}"
|
|
||||||
else
|
|
||||||
"\e[31m#{meta[:version]}* (not installed)"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def max_length
|
|
||||||
@max_length ||= installed_tools.max_by(&:length).length
|
|
||||||
end
|
|
||||||
|
|
||||||
def installed_tools
|
|
||||||
tools.keys & available_tools
|
|
||||||
end
|
|
||||||
|
|
||||||
def available_tools
|
|
||||||
TOOL_ICONS.keys
|
|
||||||
end
|
|
||||||
|
|
||||||
def installed?(meta)
|
|
||||||
meta[:source].start_with?("/")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require_relative "lib/tools"
|
require_relative "tools_lib/tools"
|
||||||
|
|
||||||
tools = Tools.new
|
tools = Tools.new
|
||||||
tools.list_tools
|
tools.list_tools
|
||||||
|
|||||||
5
bin/tools_lib/empty_file.rb
Normal file
5
bin/tools_lib/empty_file.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class EmptyFile
|
||||||
|
def lines
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -6,8 +6,7 @@ module ToolIcons
|
|||||||
"nodejs" => "\e[38;5;118m",
|
"nodejs" => "\e[38;5;118m",
|
||||||
"python" => "\e[0;33m",
|
"python" => "\e[0;33m",
|
||||||
"ruby" => "\e[1;31m",
|
"ruby" => "\e[1;31m",
|
||||||
"rust" => "\e[1;37m",
|
"rust" => "\e[1;37m"
|
||||||
"yarn" => "\e[0;34m",
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def tool_icon(tool)
|
def tool_icon(tool)
|
||||||
32
bin/tools_lib/tools.rb
Normal file
32
bin/tools_lib/tools.rb
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
require_relative "tools_file"
|
||||||
|
require_relative "tool_icons"
|
||||||
|
|
||||||
|
class Tools
|
||||||
|
include ToolIcons
|
||||||
|
|
||||||
|
attr_reader :tools
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@tools = ToolsFile.new.tools
|
||||||
|
end
|
||||||
|
|
||||||
|
def list_tools
|
||||||
|
tools.sort.each do |tool, version|
|
||||||
|
if available_tools.include? tool
|
||||||
|
puts "#{tool_icon(tool)}#{tool.ljust(max_length)} #{version}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def max_length
|
||||||
|
@max_length ||= installed_tools.max_by(&:length).length
|
||||||
|
end
|
||||||
|
|
||||||
|
def installed_tools
|
||||||
|
tools.keys & available_tools
|
||||||
|
end
|
||||||
|
|
||||||
|
def available_tools
|
||||||
|
TOOL_ICONS.keys
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
require_relative "empty_file"
|
||||||
|
|
||||||
class ToolsFile
|
class ToolsFile
|
||||||
def initialize
|
def initialize
|
||||||
end
|
end
|
||||||
@ -10,12 +12,13 @@ class ToolsFile
|
|||||||
|
|
||||||
def format_tools
|
def format_tools
|
||||||
Hash[tools_file.lines.map do |tool|
|
Hash[tools_file.lines.map do |tool|
|
||||||
name, version, source = tool.split
|
tool.split
|
||||||
[name, { version: version, source: source }]
|
|
||||||
end]
|
end]
|
||||||
end
|
end
|
||||||
|
|
||||||
def tools_file
|
def tools_file
|
||||||
`asdf current 2>&1`
|
File.read(".tool-versions")
|
||||||
|
rescue
|
||||||
|
EmptyFile.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1,10 +1,5 @@
|
|||||||
fish_add_path /opt/homebrew/bin
|
|
||||||
fish_add_path /opt/homebrew/sbin
|
|
||||||
|
|
||||||
starship init fish | source
|
starship init fish | source
|
||||||
|
|
||||||
source (brew --prefix)/opt/asdf/libexec/asdf.fish
|
source (brew --prefix)/opt/asdf/libexec/asdf.fish
|
||||||
|
|
||||||
source ~/.aliases.local
|
source ~/.aliases.local
|
||||||
|
|
||||||
set fish_user_paths .git/safe/../../bin ~/.bin
|
|
||||||
|
|||||||
@ -28,4 +28,4 @@ SETUVAR fish_pager_color_completion:\x1d
|
|||||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||||
SETUVAR fish_user_paths:\x2egit/safe/\x2e\x2e/\x2e\x2e/bin\x1e/Users/daniel\x2ebarber/\x2ebin
|
SETUVAR fish_user_paths:/Users/daniel\x2ebarber/\x2ebin\x1e\x2egit/safe/\x2e\x2e/\x2e\x2e/bin
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
format="$all$custom$jobs$directory$character"
|
format="$all$directory$character"
|
||||||
|
|
||||||
[character]
|
[character]
|
||||||
success_symbol = "[](bold cyan)"
|
success_symbol = "[](bold cyan)"
|
||||||
@ -13,21 +13,6 @@ symbol = " "
|
|||||||
[aws]
|
[aws]
|
||||||
symbol = " "
|
symbol = " "
|
||||||
|
|
||||||
[python]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[elixir]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[custom.os]
|
|
||||||
disabled = false
|
|
||||||
command = "os"
|
|
||||||
style = "bold white"
|
|
||||||
format = "[$symbol($output )]($style)"
|
|
||||||
symbol = ""
|
|
||||||
when = "true"
|
|
||||||
shell = ["bash", "--noprofile", "--norc"]
|
|
||||||
|
|
||||||
[git_branch]
|
[git_branch]
|
||||||
format = "[$symbol$branch]($style) "
|
format = "[$symbol$branch]($style) "
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
ruby 2.7.4
|
ruby 2.7.4
|
||||||
nodejs 17.3.0
|
nodejs 15.8.0
|
||||||
python 3.9.1
|
python 3.9.1
|
||||||
erlang 23.2.4
|
erlang 23.2.4
|
||||||
elixir 1.11.3
|
elixir 1.11.3
|
||||||
|
|||||||
@ -56,5 +56,3 @@ if (( $+commands[thefuck] )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$HOME/.bin:$PATH"
|
export PATH="$HOME/.bin:$PATH"
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user