mirror of
https://github.com/Morantron/tmux-fingers.git
synced 2026-09-10 07:26:32 -04:00
add info command
This commit is contained in:
parent
ab8c4be8c0
commit
33e2f0e0e2
2
.github/workflows/deployment.yml
vendored
2
.github/workflows/deployment.yml
vendored
|
|
@ -16,6 +16,8 @@ jobs:
|
|||
run: apk add --update --upgrade --no-cache --force-overwrite libxml2-dev yaml-dev yaml-static
|
||||
- name: Build
|
||||
run: shards build --production --release --static --no-debug
|
||||
env:
|
||||
WIZARD_INSTALLATION_METHOD: download-binary
|
||||
- name: Upload
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function install_from_source() {
|
|||
fi
|
||||
|
||||
pushd $CURRENT_DIR > /dev/null
|
||||
shards build --production
|
||||
WIZARD_INSTALLATION_METHOD=build-from-source shards build --production
|
||||
popd > /dev/null
|
||||
|
||||
echo "Build complete!"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ shards:
|
|||
git: https://github.com/devnote-dev/cling.git
|
||||
version: 3.0.0
|
||||
|
||||
tablo:
|
||||
git: https://github.com/hutou/tablo.git
|
||||
version: 0.10.1
|
||||
|
||||
xdg_base_directory:
|
||||
git: https://github.com/tijn/xdg_base_directory.git
|
||||
version: 1.0.5+git.commit.60bf28dc060c221d5af52727927e92b840022eb0
|
||||
|
|
|
|||
|
|
@ -12,5 +12,7 @@ dependencies:
|
|||
version: '>= 3.0.0'
|
||||
xdg_base_directory:
|
||||
github: tijn/xdg_base_directory
|
||||
tablo:
|
||||
github: hutou/tablo
|
||||
crystal: 1.14
|
||||
license: MIT
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module Fingers
|
|||
add_command Fingers::Commands::LoadConfig.new
|
||||
add_command Fingers::Commands::SendInput.new
|
||||
add_command Fingers::Commands::Start.new
|
||||
add_command Fingers::Commands::Info.new
|
||||
end
|
||||
|
||||
def run(arguments, options) : Nil
|
||||
|
|
|
|||
30
src/fingers/commands/info.cr
Normal file
30
src/fingers/commands/info.cr
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
require "cling"
|
||||
require "tablo"
|
||||
|
||||
class Fingers::Commands::Info < Cling::Command
|
||||
WIZARD_INSTALLATION_METHOD = {{ env("WIZARD_INSTALLATION_METHOD") }}
|
||||
|
||||
def setup : Nil
|
||||
@name = "info"
|
||||
end
|
||||
|
||||
def run(arguments, options) : Nil
|
||||
data = [
|
||||
["tmux-fingers", "#{Fingers::VERSION}"],
|
||||
["xdg-root-folder", "#{Fingers::Dirs::ROOT}"],
|
||||
["log-path", "#{Fingers::Dirs::LOG_PATH}"],
|
||||
["installation-method", "#{WIZARD_INSTALLATION_METHOD || "manual"}"],
|
||||
["tmux-version", `tmux -V`.chomp],
|
||||
["crystal-version", Crystal::VERSION]
|
||||
]
|
||||
|
||||
opt_width = data.map { |n| n[0].size }.max
|
||||
val_width = data.map { |n| n[1].size }.max
|
||||
|
||||
table = Tablo::Table.new(data, header_frequency: nil) do |t|
|
||||
t.add_column("Option", width: opt_width) { |n| n[0] }
|
||||
t.add_column("Value", width: val_width) { |n| n[1] }
|
||||
end
|
||||
puts table
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@ require "file_utils"
|
|||
require "xdg_base_directory"
|
||||
|
||||
module Fingers::Dirs
|
||||
TMUX_PID = (ENV["TMUX"] || ",0000").split(",")[1]
|
||||
TMUX_PID = (ENV.fetch("TMUX", ",0000")).split(",")[1]
|
||||
XDG = XdgBaseDirectory.app_directories("tmux-fingers")
|
||||
|
||||
TMP = Path[File.dirname(File.tempname)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue