Comments (3)
Consider another example
# add submodule
git submodule add <is_branch>
$ is_branch: echo "" --- --map "grep -Pq '.+' && echo 'branch=<is_branch>'" --header "are you adding submodule from a specific branch? Type the branch name if yes, or leave empty if no."
I want to create an optional example. If I write something, I must append --branch=
to the written argument. Your workaround doesn't work here.
The solution would be
# add submodule
git submodule add <prefix><is_branch>
$ is_branch: echo "" --- --header "are you adding submodule from a specific branch? Type the branch name if yes, or leave empty if no."
$ prefix: [[ -n $(echo <is_branch>) ]] && echo '--branch=' || echo '' --- --fzf-overrides '-1'
Again, a functional but ugly workaround. It would be much better to be able to write former solution.
from navi.
You can try a workaround for the same result
% sed
# Print a specific line from a file
sed -n <number>p <file>
$ file: find . -maxdepth 1 -type f | cut -c3-
$ number: aux=$(wc -l <file> | cut -f 1) && echo "This file contains $aux pages" --- --header-lines 1
from navi.
Small correction, it should be aux=$(wc -l <file> | cut -d ' ' -f 1)
, we need to define the delimiter.
Anyway, that is a good workaround, but it is a workaround. I would be great to make fzf
option aware of both shell-defined variables (e.g., $aux
) and navi-defined variables (e.g., <file>
), so that one can write something like
% sed
# Print a specific line from a file
sed -n <number>p <file>
$ file: find . -maxdepth 1 -type f | cut -c3-
$ number: export aux=$(wc -l <file> | cut -d ' ' -f 1) --- --header "The file <file> contains $aux pages "
No workarounds, no tricks, no complications.
from navi.
Related Issues (20)
- Using https://devhints.io/ as a backend HOT 1
- ":/Scoop/apps/gow/current/bin/bash.exe": E:Scoopappsnavi2.23.0navi.exe: command not found HOT 1
- Unable to execute some custom commands HOT 1
- Add optional arguments HOT 2
- Optional placeholder value for variable HOT 3
- Query with pages in subdirectory (having comma) don't work as expected HOT 3
- Import cheat sheets from other tools HOT 1
- How do I select a snippet but not execute itοΌ HOT 1
- The preview format used on Windows is only for "cmd.exe". HOT 1
- /usr/bin/bash: line 1: C:ProgramDatachocolateylibnavitoolsnavi.exe: command not found HOT 4
- ZSH widget doesn't work with VI mode HOT 1
- navi --tldr not working even with rust client tlrc HOT 4
- Add a check before running command and use glow to print markdown HOT 1
- Empty output when a variable only contains `fzf` options
- Why do we have an overlap in `fzf` options?
- Sort by usage HOT 1
- Base navi directory for cheats-path different from config-path HOT 1
- Default value for parameter HOT 1
- Add executed command in shell history
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navi.