denisidoro / navi Goto Github PK
View Code? Open in Web Editor NEWAn interactive cheatsheet tool for the command-line
License: Apache License 2.0
An interactive cheatsheet tool for the command-line
License: Apache License 2.0
If I run
navi search <anything>
I get
/opt/navi/src/opts.sh: line 43: wait_for: readonly variable
This is on Arch Linux, navi version 0.8.1, zsh shell. Same things happens if I switch to bash.
I didn't manage to find a related issue, so I'd appreciate any input on what might be wrong. I suppose the cause is #12 thought?
Thanks.
Edit: Actually, I was blind and didn't see I also get it when I just run normal navi, but there it's line 44, same exact error. The command itself works though, in that case.
The script should be aborted if a regex isn't matched, to avoid arbitrary code execution
Hitting Ctrl-G
for example could start the script.
When selecting an entry, instead of executing it, it could fill the prompt (similarly to ctrl-r).
This way the history will be kept clean and there will be the possibility to edit the command as you like.
Edit: this is done for zsh, bash and zsh already!
Please refer to README.md.
I've been using skim for a while now, and if I change the commands from fzf
to sk
, it invokes fine, but interactive searching doesn't work so well. I'm sure there are some differences between -i
in both tools, but do not know how to move forward.
great tool and some suggest
I think you can add a variable support string and suggest that possible values for a given argument can be entered instead of not returning directly.
Add command ls -lR|grep '^-'|wc -l
to a cheat file and choose it. Error info "No valid cheatsheet!"
When I use navi
to create database, an error occur like below:
/opt/dry/navi/src/main.sh: line 35: database: unbound variable
I use Mac iTerm, and my operation step is as below:
navi
in the iTermcreate database
, then press Enterroot
after user:
, then press Enterthen, the result is as below:
β cheats git:(master) navi
/opt/dry/navi/src/main.sh: line 35: database: unbound variable
anyone who can tell me how to use it in centos7 ? i can not install it in linux ,it did not work
When I use conda activate <env>
in zsh, and type env: base
. It failed.
I already followed the steps in the steps in Installation using oh-my-zsh and added export PATH=$PATH:"$ZSH_CUSTOM/plugins/navi"
in my ~/.zshrc
.
I also tried and conda init zsh
. It doesn't work.
Here are Error commands:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
Hi,
Navi is sweet, thanks for making it :)
I have a white background in my terminal, and unfortunately the default color scheme is not quite as readable as a dark background. Is it possible to get an option or environment variable for a different color scheme that would work better on light backgrounds?
Thanks!
Hi @denisidoro,
Any chance of supporting multiline commands, such as:
command abc xyz \
--param1 foo \
--param2 bar
Or some other method of running more complex commands (think involved things with pipes).
Thanks π
Reproduce steps:
git checkout
Environment:
mac
iterm2
zsh
fzf: 0.17.1 (brew)
Not enough issues, not professional enough
I see these two errors back to back after ever command I try.
navi
while in a directory that has a git repogit check
git checkout <branch> [git]
result:
22:20 $ navi
grep: Invalid range end
/opt/navi/src/main.sh: eval: line 35: syntax error near unexpected token `newline'
get the same result if I choose # Checkout to branch [git]
, or any other option at all such as netstat ...
, tar xf <tar_file>
, etc
OS: Ubuntu 18.04.3
shell: GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
grep: grep (GNU grep) 3.1
fzf: 0.18.0 (ff95134)
I noticed in the README mention of brew. is it possible this tool was built to run with BSD grep?
btw, this tool looks great! I've always wanted to make something very much like this. Thanks for building it!
Please add support to Windows (Choco, curl)
Take this snippet for example:
# Copy file/s from source to destination
cp <source> <dest>
$ source: ls
$ dest: ls
This simply breaks the whole operation of the script.
Related: Homebrew/homebrew-core#45695
navi --cheatsh awk
could browse the snippets for awk defined on http://cheat.sh/ for example
Hi @denisidoro,
It seems that right now, parameters are always enclosed in quotes. While this works in most cases, it makes it hard to do simple commands like:
curl http://example.com/<arg1>/foo/<arg2>
The resulting command would be:
curl http://example.com/"value1"/foo/"value2"
Instead of simply:
curl http://example.com/value1/foo/value2
Ideas?
Thanks.
When I call navi from command line I always get "Unable to find command for '...".
It seems like navi is ignoring the first character under selected item. Refer to image, please.
I have just cloned the repo and tried whith the navi executable.
git clone [email protected]:denisidoro/navi.git
cd navi
./navi
It's not evident that variables should only contain alphanumeric characters and underscores.
Using spaces and dashes would make variable references in scripts non trivial, though (eg "image name" would become "image_name").
Instead of running cat $cheat
, we could call a function such as memoized_cat
so that we don't need to perform IO on each keypress.
We could additionally store a map going from tags to a cheatsheet.
Printing without specifying --print
should occur if, and only if, there are unresolved arguments
Hi @denisidoro,
Is it possible to get a flag to show the command before it gets executed. It would be even better if it could be added to shell history, so it can be quickly recalled.
Thoughts?
Thanks π
There are missing double quotes. I think it will allow at most 1 argument as-is.
docker rm -f $(docker ps -aq)
will execute docker ps -aq
when highlighted in FZF
If there's a single option available, fzf shouldn't be prompted. The single value should be auto-selected.
A --no-autoselect
could be added as well.
Since #47, navi won't work on alpine
I think it's related to sed
Hi, Love the project.
Was expecting the following to work:
% fileinsubdir
# Cat a file in a subdir
cat -f <dir>/<file>
$ dir: find . -maxdepth 1 -type d --- --column 1
$ file: find "$dir" -maxdepth 1 -type f --- column 1
However it just prompts me for input
$ navi
dir file:
I think it thinks there's one option called "dir file" instead of two?
Likewise the MySQL ones just prompt for
$ navi
user database path:
And even entering three values, seperated by spaces just causes it to keep printing out the same thing until ^C.
Tried with both HEAD and v0.9.2
Use fzf's --preview
flag so that you know what you'll run
When following the oh-my-zsh instructions I run into an issue where the command is not found. zsh: command not found: navi
This prevents me from being able to use it as a widget. Are the instructions missing a step, am I supposed to link the executable in /usr/bin/local or something so that its available? If I install it using homebrew the command is available and will execute but the instructions are not clear on whether or not I have to follow two of the three possible steps to get it working properly.
I can't find any record of Navi being a Homebrew package.
~/P/A brew update
Already up-to-date.
~/P/A/ brew install navi
Error: No available formula with the name "navi"
I search https://brew.sh/ for good measure.
The documentation doesn't say anything about a special formula, and I don't see a formula definition in the repo at first glance.
Am I missing something?
Hi,
Thanks for the project.
I have noticed a bug when I use the binding ctrl+g in bash.
This command in a cheat fails because it replaces the \1
by ^A
In my cheat it's
# Find primary, local IP address
ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
The command parsed after the binding is
ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/^A/p'
Terminal: tilix
bash 5.0.11
Thanks !
Well done! Awesome project!!
This project bring new answer for the question What is cheatsheet for Linux?
Since that everything is good. In my opinion, default behaviour is not safe since it's runs selected command even knowing what is command.
For example if I will use docker rmi
command to additionally navi
runs
$ docker images --- --headers 1 --column 3
and select argument by column base selector.
Any mistake in this process like
In this cases user can delete wrong things and this can create problem for user.
Absolutelly I understand this is not your responsibility and also you mentioned also in the help page. To being safe and secure use --print
option.
To prevent those problems, I wrote 2 simple bash function which could be new feature for this project.
function naviprint()
{
PRINT_OUTPUT=$(navi --print)
export NAVI_LAST_COMMAND=$(echo $PRINT_OUTPUT)
echo "$NAVI_LAST_COMMAND"
}
# Can be as used as navi lastcommand
function navilast()
{
eval $NAVI_LAST_COMMAND
}
Thank you for your effort!
Best Regards,
Enis
After installing navi using sudo make install
, and running using navi
I get this error:
/opt/navi/src/ui.sh: line 4: fzf: command not found
And after running sudo apt install fzf
it worked fine.
Hello, tac
command is not available by default in OSX. Maybe it's worth a mention in the README, as a requirement if you use the shell widget option.
Is it possible to have an install route without the need for sudo?
Is there a chance the license to be changed?
Some big tech companies have AGPL-3 blacklisted.
navi best βprimary ip"
could automatically execute the snippet which best matches the query, for example.
Flags such as --print
should still work accordingly.
I'm working on my macOS terminal. And I can not activate navi
widget on zsh with alt+g
hotkey.
I'm not sure whether it has something to do with the alt
key on Apple keyboard layout. Can I change the default activation hotkey?
Calculating the sha256 by hand should be possible without brew
There is no LICENSE or COPYING file for this project. The default is copyright.
You should license this project under the AGPL3 or GPL3 license. Directions on how to apply the license are at the bottom of the license file under the How to Apply These Terms to Your New Programs
heading. There is a helpful guide for the GPL at https://www.gnu.org/licenses/gpl-howto.en.html. If you would like me to submit a PR to make this easier, I would be happy to do that.
As of now, to go from an FZF selection to a snippet, navi:
This brings problems such as borking if a file has no tags and so on.
After
git clone http://github.com/denisidoro/navi /opt/navi
sudo git clone http://github.com/denisidoro/navi /opt/navi
cd /opt/navi
Everything is normal.
But after
sudo make install
It outputs
scripts/install
and I can't invoke navi.
The output after invoking navi is
/opt/navi/src/ui.sh: line 4: fzf: command not found
grep: Invalid range end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.