From 231f9775ba4ef523514a1eb4499d2eefcb025c69 Mon Sep 17 00:00:00 2001 From: Denis Isidoro Date: Fri, 10 Jul 2020 10:10:38 -0300 Subject: [PATCH] Widget: fix behavior for % (#368) --- Cargo.lock | 2 +- Cargo.toml | 2 +- alfred/alfred0.bash | 4 +- alfred/alfred1.bash | 9 ++- alfred/alfred2.bash | 6 +- alfred/info.plist | 138 +++++++++++++++++++++++++++++++---------- shell/navi.plugin.bash | 2 +- shell/navi.plugin.zsh | 2 +- 8 files changed, 122 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 25cbfc9..8642910 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,7 +174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "navi" -version = "2.7.0" +version = "2.7.1" dependencies = [ "anyhow 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 56211cf..2c51316 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "navi" -version = "2.7.0" +version = "2.7.1" authors = ["Denis Isidoro "] edition = "2018" description = "An interactive cheatsheet tool for the command-line" diff --git a/alfred/alfred0.bash b/alfred/alfred0.bash index 0945ffc..7976690 100755 --- a/alfred/alfred0.bash +++ b/alfred/alfred0.bash @@ -1,7 +1,9 @@ #!/bin/bash +source "${HOME}/.bashrc" +export PATH="/usr/local/bin:$PATH" + if [ -n "${snippet:-}" ]; then - source "${HOME}/.bashrc" echo -n "$(navi alfred check)" else echo -n "__start" diff --git a/alfred/alfred1.bash b/alfred/alfred1.bash index 7ab181f..a1424a3 100755 --- a/alfred/alfred1.bash +++ b/alfred/alfred1.bash @@ -1,9 +1,14 @@ #!/bin/bash source "${HOME}/.bashrc" +export PATH="/usr/local/bin:$PATH" + +_hack() { + sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' +} if [ -n "${snippet:-}" ]; then - navi alfred suggestions + navi alfred suggestions | _hack else - navi alfred start + navi alfred start | _hack fi diff --git a/alfred/alfred2.bash b/alfred/alfred2.bash index dee4398..d067437 100755 --- a/alfred/alfred2.bash +++ b/alfred/alfred2.bash @@ -1,8 +1,10 @@ #!/bin/bash +source "${HOME}/.bashrc" +export PATH="/usr/local/bin:$PATH" + if [ -n "${varname:-}" ]; then - source "${HOME}/.bashrc" - echo -n "$(navi alfred transform)" + echo -n "$(navi alfred transform)" | tr -d '\n' else echo -n "$snippet" fi diff --git a/alfred/info.plist b/alfred/info.plist index 10c1843..abfb25c 100644 --- a/alfred/info.plist +++ b/alfred/info.plist @@ -46,6 +46,16 @@ vitoclose + + destinationuid + 4B245423-CD5B-4FB1-A819-4214E93BC683 + modifiers + 0 + modifiersubtext + + vitoclose + + 2B0EE026-57A9-4097-ACE7-FE4E78F20EC0 @@ -96,6 +106,16 @@ vitoclose + + destinationuid + BD60B64B-EC93-467E-AEC2-0489A3090113 + modifiers + 0 + modifiersubtext + + vitoclose + + 55C46852-4807-4374-95AB-CC055F4ECB7C @@ -414,29 +434,6 @@ fi version 3 - - config - - concurrently - - escaping - 102 - script - echo asdsds - scriptargtype - 1 - scriptfile - alfred2.bash - type - 8 - - type - alfred.workflow.action.script - uid - 3CE4BEC1-BEBE-4A11-B182-E63693AE2FE6 - version - 2 - config @@ -488,6 +485,29 @@ fi version 1 + + config + + concurrently + + escaping + 102 + script + echo asdsds + scriptargtype + 1 + scriptfile + alfred2.bash + type + 8 + + type + alfred.workflow.action.script + uid + 3CE4BEC1-BEBE-4A11-B182-E63693AE2FE6 + version + 2 + config @@ -679,6 +699,23 @@ fi version 2 + + config + + argument + '{query}', {allvars} + cleardebuggertext + + processoutputs + + + type + alfred.workflow.utility.debug + uid + BD60B64B-EC93-467E-AEC2-0489A3090113 + version + 1 + config @@ -687,7 +724,9 @@ fi escaping 0 script - source $HOME/.bashrc + source "${HOME}/.bashrc" +export PATH="/usr/local/bin:$PATH" + eval "$snippet" scriptargtype 0 @@ -758,6 +797,23 @@ eval "$snippet" version 1 + + config + + argument + '{query}', {allvars} + cleardebuggertext + + processoutputs + + + type + alfred.workflow.utility.debug + uid + 4B245423-CD5B-4FB1-A819-4214E93BC683 + version + 1 + readme @@ -780,9 +836,9 @@ eval "$snippet" 282E2B68-29A1-4EF0-B328-2BE38CBF67F0 xpos - 1210 + 1185 ypos - 270 + 275 2B0EE026-57A9-4097-ACE7-FE4E78F20EC0 @@ -794,9 +850,16 @@ eval "$snippet" 3CE4BEC1-BEBE-4A11-B182-E63693AE2FE6 xpos - 815 + 820 ypos - 160 + 165 + + 4B245423-CD5B-4FB1-A819-4214E93BC683 + + xpos + 1355 + ypos + 455 529BC67C-C77D-41CA-B095-996CC1317556 @@ -824,21 +887,21 @@ eval "$snippet" xpos 615 ypos - 85 + 80 93437EDA-0308-467D-BE3F-6855C638D49D xpos - 1235 + 1230 ypos 60 98658166-32FC-4F9D-8247-52BEDE6394EE xpos - 980 + 985 ypos - 190 + 195 ABA74294-992D-4528-A609-964B0ACA9346 @@ -850,7 +913,7 @@ eval "$snippet" B3B967BC-EC30-47DE-B233-2F3F97568857 xpos - 595 + 600 ypos 350 @@ -859,7 +922,14 @@ eval "$snippet" xpos 1055 ypos - 180 + 185 + + BD60B64B-EC93-467E-AEC2-0489A3090113 + + xpos + 1010 + ypos + 340 E8FC4B20-3DD5-4684-97C0-FBBC2FC1AD45 diff --git a/shell/navi.plugin.bash b/shell/navi.plugin.bash index 342d924..6b44ed1 100644 --- a/shell/navi.plugin.bash +++ b/shell/navi.plugin.bash @@ -5,7 +5,7 @@ __call_navi() { local -r linecount="$(echo "$result" | wc -l)" if [[ "$linecount" -lt 2 ]]; then - printf "$result" + printf "%s" "$result" return 0 fi diff --git a/shell/navi.plugin.zsh b/shell/navi.plugin.zsh index 0ad3546..ef2d327 100644 --- a/shell/navi.plugin.zsh +++ b/shell/navi.plugin.zsh @@ -2,7 +2,7 @@ _call_navi() { local selected - if selected="$(printf "$(navi --print