From 4e3e857b0a5d6aaca157acfd7e3c655b30c65ae8 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Thu, 13 Jan 2022 19:29:48 +0200 Subject: [PATCH] Cleanups and tweaks --- README.md | 1 + files/dotfiles/shellconfig/cheat.sh | 13 ++++--- files/dotfiles/shellconfig/cheat/commands | 35 ------------------- .../shellconfig/cheat/{languages => topics} | 20 ++++++++--- files/dotfiles/shellconfig/common.sh | 14 +++++++- files/dotfiles/tmux.conf | 2 +- roles/base/tasks/main.yml | 12 ++----- roles/modern_unix_tools/tasks/main.yml | 2 +- 8 files changed, 40 insertions(+), 59 deletions(-) delete mode 100644 files/dotfiles/shellconfig/cheat/commands rename files/dotfiles/shellconfig/cheat/{languages => topics} (65%) diff --git a/README.md b/README.md index e548d86..060feff 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,4 @@ $ ./run_play.sh # Defaults to workstation ### Playbooks - workstation - cli-tools + - self-managed-unix-update (Updating all packages from the modern unix role) diff --git a/files/dotfiles/shellconfig/cheat.sh b/files/dotfiles/shellconfig/cheat.sh index 86c46e3..ec0d79c 100755 --- a/files/dotfiles/shellconfig/cheat.sh +++ b/files/dotfiles/shellconfig/cheat.sh @@ -4,17 +4,16 @@ ######################################################## # Get docs fast -selected=`/bin/cat ~/.shellconfig/cheat/languages ~/.shellconfig/cheat/commands | fzf --header="Select a topic"` +selected=`cat ~/.shellconfig/cheat/topics | fzf --header="🏳️ Select a Topic: " --reverse` if [[ -z $selected ]]; then exit 0 fi -read -p "Enter Query: " query +read -p "What you want to know?: " query -if grep -qs "$selected" ~/.shellconfig/cheat/languages; then - query=`echo $query | tr ' ' '+'` - tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done" +query=`echo $query | tr ' ' '+'` +if [[ $selected == "TLDR" ]]; then + tmux neww -n "[🏳️ Cheat: ${selected}/${query}]" bash -c "tldr ${query} | bat --paging=always --file-name='${selected} | Query: ${query}'" else - tmux neww bash -c "curl -s cht.sh/$selected~$query | less" + tmux neww -n "[🏳️ Cheat: ${selected}/${query}]" bash -c "curl -s https://cht.sh/$selected/$query | bat --paging=always --file-name='Topic: ${selected} | Query: ${query}'" fi - diff --git a/files/dotfiles/shellconfig/cheat/commands b/files/dotfiles/shellconfig/cheat/commands deleted file mode 100644 index 135e6b9..0000000 --- a/files/dotfiles/shellconfig/cheat/commands +++ /dev/null @@ -1,35 +0,0 @@ -find -fzf -man -tldr -sed -awk -tr -cp -ls -grep -xargs -ps -mv -kill -lsof -less -head -tail -tar -rm -jq -cat -ssh -cargo -git -podman -docker -docker-compose -chmod -chown -make -kubectl -oc -ocp -systemctl diff --git a/files/dotfiles/shellconfig/cheat/languages b/files/dotfiles/shellconfig/cheat/topics similarity index 65% rename from files/dotfiles/shellconfig/cheat/languages rename to files/dotfiles/shellconfig/cheat/topics index 8693a22..d83970c 100644 --- a/files/dotfiles/shellconfig/cheat/languages +++ b/files/dotfiles/shellconfig/cheat/topics @@ -1,15 +1,25 @@ +TLDR golang -nodejs +ansible yaml +python +bash +typescript +nodejs javascript tmux -typescript zsh cpp c rust -python -bash css markdown -ansible +linux +systemd +jq +kubectl +oc +grep +sed +awk +tr diff --git a/files/dotfiles/shellconfig/common.sh b/files/dotfiles/shellconfig/common.sh index 4266075..c4111f7 100644 --- a/files/dotfiles/shellconfig/common.sh +++ b/files/dotfiles/shellconfig/common.sh @@ -71,7 +71,19 @@ function ide() { pre_check_tmux_for_layout "ide" || return 1 - tmux send-keys "l" C-m + echo "=-=-=-=-=-=-=-=-=-=-=-=-=-="; \ + echo "${IDE_NAME}"; \ + echo "=-=-=-=-=-=-=-=-=-=-=-=-=-="; \ + echo;echo Status:; \ + echo -=-=-=-; \ + git status; \ + echo; \ + echo Remotes:; \ + echo -=-=-=-=; \ + git remote -v | cat; \ + echo;echo Files:; \ + echo -=-=-=; \ + ls -l tmux split-window -h -p 80 tmux split-window -h -p 30 tmux send-keys "gitui" C-m diff --git a/files/dotfiles/tmux.conf b/files/dotfiles/tmux.conf index dfdd6b1..4616dac 100644 --- a/files/dotfiles/tmux.conf +++ b/files/dotfiles/tmux.conf @@ -25,7 +25,7 @@ bind-key - split-window -v -c "#{pane_current_path}" # close window with bind-key q kill-window # refresh window with -bind-key e respawn-window -k +bind-key e respawn-window -k -c "#{pane_current_path}" # -j/k for up down (useful to move between history commands) bind-key k send-keys Up diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index e51106c..f085d11 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -108,16 +108,10 @@ dest: ~/.shellconfig/environment.sh force: no -- name: Copy languages cheat sheet list +- name: Copy topics cheat sheet list copy: - src: dotfiles/shellconfig/cheat/languages - dest: ~/.shellconfig/cheat/languages - force: yes - -- name: Copy commands cheat sheet list - copy: - src: dotfiles/shellconfig/cheat/commands - dest: ~/.shellconfig/cheat/commands + src: dotfiles/shellconfig/cheat/topics + dest: ~/.shellconfig/cheat/topics force: yes - name: Install modern UNIX tools diff --git a/roles/modern_unix_tools/tasks/main.yml b/roles/modern_unix_tools/tasks/main.yml index afb17f2..e3d1c0e 100644 --- a/roles/modern_unix_tools/tasks/main.yml +++ b/roles/modern_unix_tools/tasks/main.yml @@ -27,7 +27,7 @@ name: btm repo: ClementTsang/bottom bin_path: "/btm" - autocomplete_path: "/completion/btm.bash" + #autocomplete_path: "/completion/btm.bash" filter: bottom_x86_64-unknown-linux-gnu.tar.gz - name: Installing gitui