Commit graph

319 commits

Author SHA1 Message Date
Denis Isidoro
3f66614818 Bump 2020-03-16 10:22:37 -03:00
Denis Isidoro
7eccec0a51 linting 2020-03-16 08:14:02 -03:00
Denis Isidoro
dd6c54f089 wip 2020-03-16 08:13:55 -03:00
Denis Isidoro
ebcdb8d162 linting 2020-03-16 08:02:52 -03:00
Denis Isidoro
fcfa7843fc wip 2020-03-16 08:02:23 -03:00
Denis Isidoro
92cf10d10a
Allow repos with @ (#272) 2020-03-15 22:13:18 -03:00
Denis Isidoro
07134996e4
Use data_dir for cheats 2020-03-15 20:26:48 -03:00
Denis Isidoro
de16846aba
Initial cheat repo support (#258)
This PR makes navi stop bundling `.cheat` files and makes it able to download from repos on GitHub, using a standardized config directory.

- it fixes #233 and #237
- it makes #52, #256 and #257 much easier to implement
- it makes #40 harder to implement
- it's an alternate solution to #140 
- it's influenced by #238 and #254.

This PR ended up being much bigger than I would like so if you could review only this description it would be already very nice!

When navi is started for the first time, a welcome cheatsheet is shown:
![Screenshot at 2020-03-15 10-20-04](https://user-images.githubusercontent.com/3226564/76702240-19fffd80-66a7-11ea-884f-97c565bc1ead.png)

If the user selects the first option, the user is prompted to download `.cheat`s from https://github.com/denisidoro/cheats: 
![Screenshot at 2020-03-15 10-20-35](https://user-images.githubusercontent.com/3226564/76702239-19fffd80-66a7-11ea-8f69-324f669b1e01.png)
![Screenshot at 2020-03-15 10-22-59](https://user-images.githubusercontent.com/3226564/76702236-18363a00-66a7-11ea-8ff4-53b497f85888.png)

The config folder is populated:
![Screenshot at 2020-03-15 10-21-11](https://user-images.githubusercontent.com/3226564/76702238-19676700-66a7-11ea-8367-3e7b5733f2b4.png)

When run again, cheats are available:
![Screenshot at 2020-03-15 10-21-34](https://user-images.githubusercontent.com/3226564/76702237-19676700-66a7-11ea-9c2a-d8829340f3e9.png)

### Breaking changes

In order to make navi stop bundling shell widgets as well, a breaking change has been introduced: `source $(navi widget bash)` won't work anymore. It should be `source <(navi widget bash)` now. Any ideas on how to make this transition more graceful?
2020-03-15 13:46:58 -03:00
Denis Isidoro
48c2b64f7f
Static newline regex (#264) 2020-03-14 18:22:39 -03:00
asd
1678564800 💅 2020-03-14 18:14:30 -03:00
Denis Isidoro
3fa141846b
Allow multiline commands (#262)
Fixes #260
2020-03-14 18:08:57 -03:00
Denis Isidoro
5423cd8ccb
wip (#261) 2020-03-14 15:34:26 -03:00
Ingolf Wagner
0d22fe49ab
pull request comments 2020-03-14 23:46:33 +08:00
Ingolf Wagner
3617126f6a
cosmetics 2020-03-14 20:53:27 +08:00
Ingolf Wagner
af6fba3c31
run cargo fmt 2020-03-14 20:33:07 +08:00
Ingolf Wagner
0a22398a47
add --allow-extra option 2020-03-14 20:32:00 +08:00
Ingolf Wagner
8669ba9829
changed suggestion processing and signaling for fzf 2020-03-14 20:32:00 +08:00
Ingolf Wagner
50627492f3
minor refactorings 2020-03-14 20:31:59 +08:00
Ingolf Wagner
6f4c5ba25b
add variable name to prompt with suggestions 2020-03-14 03:22:57 +08:00
Denis Isidoro
e40a0e2dc4
Reuse variables (#252)
Fixes #251
2020-03-13 08:27:19 -03:00
Denis Isidoro
f8e8da018b
Minor theme change (#246) 2020-03-12 23:58:51 -03:00
Denis Isidoro
7f4fc90116
Prevent panic when there are no cheats (#244)
Fixes #243
2020-03-12 23:32:28 -03:00
Denis Isidoro
f6a4fec13d
Add support for variable dependency (#242)
Fixes #203
2020-03-12 21:39:15 -03:00
Denis Isidoro
c5b3b175f6
Add support for navi fn (#241)
Fixes #208
2020-03-12 21:05:18 -03:00
Denis Isidoro
e32e0f1245
Fix delimiter (#239)
Fixes #230
2020-03-12 19:04:47 -03:00
Denis Isidoro
60a77e828a
Merge branch 'master' into fix-badcmd 2020-03-12 17:43:34 -03:00
Denis Isidoro
0f8b9853b6 Bump 2020-03-12 17:42:56 -03:00
Austin Jones
41951e22a4 Fix crash when user enters a command that doesn't exist 2020-03-12 14:16:56 -04:00
Denis Isidoro
ce9c22100a
Allow overriding FZF variables (#235)
`$FZF_DEFAULT_OPTS` won't work in some use cases because it has lower precedence then hardcoded settings such as `--exact`.

Usage:
```
export NAVI_FZF_OVERRIDES=" --no-exact"
navi
```

Fixes #232
2020-03-12 14:57:02 -03:00
Denis Isidoro
a1dea118c0
Fix path issues (#231)
Fixes #224 and #228
2020-03-12 13:03:04 -03:00
Denis Isidoro
770793317b
Handle relative symlinks (#225)
Attempts to solve #224 and #223
2020-03-11 20:26:00 -03:00
Denis Isidoro
06eae50613
Minor fixes (#221) 2020-03-11 11:30:25 -03:00
Denis Isidoro
751393309f
Defensive cheats folder (#220) 2020-03-10 14:01:28 -03:00
Denis Isidoro
44d072de94
Be more defensive with /dev/tty (#219) 2020-03-10 13:32:22 -03:00
Denis Isidoro
4a1bbd39ab
Add support for metacomment (#216)
Fixes https://github.com/denisidoro/navi/issues/215
2020-03-09 15:02:54 -03:00
Denis Isidoro
233f5ca8c1 Terminal width fallback 2020-03-09 13:57:48 -03:00
asd
44d3d1bec8 Fix linting 2020-03-07 18:37:35 -03:00
Denis Isidoro
62e0d2cb94
Move code to fzf.rs 2020-03-07 18:08:31 -03:00
Denis Isidoro
ac61dd09b4
Fix use in subshell (#213) 2020-03-07 18:03:51 -03:00
Denis Isidoro
dc4fe98f56
Fix best command (#210) 2020-03-05 17:40:14 -03:00
Denis Isidoro
fe26b00953
Follow symlinks for exe (#209) 2020-03-05 16:29:49 -03:00
Denis Isidoro
c5cd85bb41
Rust implementation (#197) 2020-03-04 18:01:23 -03:00
bitozoid
cf7201af7a
Limit dep order filter
To fix #182.
2020-02-03 10:42:51 +00:00
Denis Isidoro
dbcd7eae4a
Revert "Correctly escape backslashes" (#181)
Reverts #177

Fixes #179 but reopens #131
2020-01-22 17:26:25 -03:00
Denis Isidoro
e9dc75555b
Correctly escape backslashes (#177)
Fixes #131
2020-01-20 16:44:21 -03:00
Denis Isidoro
a70c6dfadd
Add support for multiple choice (#175)
Fixes #173
2020-01-17 15:29:16 -03:00
Denis Isidoro
8f2bc5f7e7
Fish: fix widget (#174)
Fixes #170 and #171
2020-01-17 14:41:23 -03:00
Denis Isidoro
ac39ac630c Bump to 0.17.0 2019-12-17 13:36:57 -03:00
Dawid Dziurla
7bc7f2304f
Fix preview in fish shell 2019-12-16 16:03:01 +01:00
Denis Isidoro
0b2e67c3d0
Add bindings for C-j and C-k (#165)
Fixes #164
2019-12-09 11:08:24 -03:00
Denis Isidoro
42ac8dae9c
Remove dep order from outputs (#163)
`: <foo> <bar>; echo <foo> <bar>` → `echo <foo> <bar>`
2019-12-06 14:24:14 -03:00
Denis Isidoro
1c2dca3284
Fix "navi best" command (#162) 2019-12-05 14:37:08 -03:00
Denis Isidoro
bedbafc6ff
Expand tildes in paths (#160)
Fixes #159
2019-11-22 12:56:41 -03:00
Denis Isidoro
3c53e7b637
Add option to change colors (#147)
Fixes #145
2019-11-07 17:05:15 -03:00
Denis Isidoro
1bd1730e8d
Use 2+ spaces as column separator (#156)
Fixes #153
2019-11-06 15:29:32 -03:00
Denis Isidoro
e3f6a0418d
Add keybinding to copy snippet (#155)
Fixes #152
2019-11-06 15:22:28 -03:00
Denis Isidoro
434ab57dc2
Update demo gif (#143) 2019-10-29 16:17:42 -03:00
Denis Isidoro
72f75b6f24 Make it work without column 2019-10-28 17:30:05 -03:00
Denis Isidoro
e9ed64bd01 Fix FZF_DEFAULT_OPTS error 2019-10-28 17:08:35 -03:00
Denis Isidoro
a0c5a6293b
Refactor list visualization (#138)
Fixes #137 

![Demo](https://user-images.githubusercontent.com/3226564/67512211-b2e99a00-f66e-11e9-8ffe-09f30cb54599.png)
2019-10-28 16:56:19 -03:00
amelia
e8a70265f5 follow symlinks for cheatsheet directories 2019-10-23 14:36:48 -04:00
Denis Isidoro
bcf3f3576a
Correctly escape backslashes (#132) 2019-10-18 13:21:11 -03:00
lpy-neo
9c61f287c1
fix bug about variable suggestion 2019-10-15 20:50:21 +08:00
Denis Isidoro
69e74204b2
Minor changes (#122) 2019-10-11 14:33:16 -03:00
Denis Isidoro
40ed4e60ba Fix command_exists for empty string 2019-10-05 14:17:41 -03:00
Denis Isidoro
6129d9e954
Refactor string escaping code (#114)
Fix #111
2019-10-05 14:08:00 -03:00
Emerson MX
f2d2c6cc57 Fix read only error 2019-10-04 20:16:14 -03:00
Denis Isidoro
b7c5fb8fea
Add possibility to pass argument values (#110)
If `navi best github` prompts for `user`, then `navi best github foo` will consider `foo` as `user`.
2019-10-04 18:13:11 -03:00
Denis Isidoro
0941166c9c Fix regex checks 2019-10-03 14:39:23 -03:00
Priya Pandya
7c767810e4 [src]: Add condition to check regex for arg/escaped_arg (#109)
Fixes #20
2019-10-03 14:34:05 -03:00
Denis Isidoro
78638c67e4
Add fallback to tac (#108)
Fix #107
2019-10-03 12:56:36 -03:00
Denis Isidoro
8e606a50ba
Limit cheat for selection (#102)
Say we have a cheat with a free input for `<foo>` and there's another cheat with suggestions for `<foo>`. If you select a command from the first cheat, the suggestions in the second cheat would be used, before this PR.
2019-10-02 12:14:07 -03:00
Denis Isidoro
4627b5db0b
Add widget for bash (#105)
Partially solves #37
2019-10-02 12:12:20 -03:00
Alexandre Beaulieu
286cb9f97f
doc: code review changes. 2019-10-01 17:41:34 -04:00
Denis Isidoro
0c960fca54
Interpolation: only quote multi-word values (#100)
- Fixes #99 
- adds `platform::existing_command`
2019-09-30 11:27:03 -03:00
Denis Isidoro
97329b97f6
Show comment for command in preview window (#98) 2019-09-28 23:58:00 -03:00
Denis Isidoro
d04dfc1003
Allow variable names to include dashes and spaces (#97)
Based on https://github.com/denisidoro/navi/pull/95 by @engrravijain 

Fixes #60
2019-09-28 23:24:12 -03:00
Denis Isidoro
2aa07c2ce1
Minor fixes (#96)
- fix widget
- cleanup
- fix dict lib
2019-09-28 23:12:47 -03:00
Denis Isidoro
d55b5725d4
Correctly escape % in cheatsheets (#94) 2019-09-27 16:53:31 -03:00
Denis Isidoro
0eeb3218b0 Fix typo 2019-09-27 15:12:55 -03:00
Denis Isidoro
260966ba6c Improve zsh widget (#92) 2019-09-27 15:12:55 -03:00
Denis Isidoro
b9084c0439 Add suppot for multiline snippets (#91)
Fix #88
2019-09-27 15:12:55 -03:00
Denis Isidoro
00a2d2b91e Escape subshells in cheatsheets (#90)
Fix #85
2019-09-27 15:12:55 -03:00
Denis Isidoro
303f9f67d1 Remove unnecessary echo 2019-09-27 15:12:55 -03:00
Denis Isidoro
473b409c93 Store cheatsheets in memory (#86)
Fixes #61 and kind of fixes #76 (actually it still depend on tags to find a snippet but that's not a problem anymore since everything is in memory now)
2019-09-27 15:12:55 -03:00
Denis Isidoro
b6a5ac1495 Improve test coverage (#84)
Add integration tests
2019-09-27 15:12:55 -03:00
Denis Isidoro
beab843c1e Add option for calling best match directly (#83)
Fix #62
2019-09-27 15:12:55 -03:00
Denis Isidoro
9dce96a871 Improve lib for collections (#82) 2019-09-27 15:12:55 -03:00
Denis Isidoro
1b12ffa330 Refactor option parsing (#79) 2019-09-27 15:12:55 -03:00
Denis Isidoro
093bac0e9f Add MVP for functional programming 2019-09-27 15:12:55 -03:00
Denis Isidoro
64be01bf1a
Fix escaping issues (#73)
Fix #72
2019-09-25 11:44:57 -03:00
Denis Isidoro
a802671f6a
Bump to 0.9.3 (#70) 2019-09-25 08:16:30 -03:00
Denis Isidoro
d974340939
Suppress tput errors (#69) 2019-09-25 08:04:06 -03:00
Denis Isidoro
ea0fb00371
Autoselect on single option (#68)
Based on #https://github.com/denisidoro/navi/pull/53 by @nikush.

Fixes #44.
2019-09-25 08:02:35 -03:00
Denis Isidoro
516578479c
Fix snippets with multiple arguments (#67) 2019-09-25 07:50:32 -03:00
Denis Isidoro
36cd52f93d
Minor refactor (#57)
- [x] Define OPTIONS as global in opts::eval
- [x] Add script
- [x] Minor changes
2019-09-24 16:13:57 -03:00
Denis Isidoro
2ee253a56e
Add workaround for --help (#54)
My latest refactor didn't play nice with `--help`so I'm adding this workaround
2019-09-23 19:52:02 -03:00
Denis Isidoro
95fc254736
Add MVP for zsh widget (#50)
Related: #37
2019-09-23 18:14:58 -03:00
Denis Isidoro
c4e9c7a90a
Refactor code (#49)
Use dictionaries + more
2019-09-23 17:46:16 -03:00
Denis Isidoro
2753e84ea6
Revert "Use dictionaries (#47)" (#48)
This reverts commit 9848d7b39a.
2019-09-23 15:08:36 -03:00
Denis Isidoro
9848d7b39a
Use dictionaries (#47)
In order to cleanup the code

Related: https://medium.com/@den.isidoro/dictionaries-in-shell-scripts-61d34e1c91c6

Possibly fix #43 (but may bring other inconsistencies)
2019-09-23 14:36:15 -03:00
Denis Isidoro
13446d9883
Prevent wait_for error (#46)
Fix #45
2019-09-23 14:15:19 -03:00
Denis Isidoro
a21f39ee64
Fix local readonly (#42)
Based on https://github.com/denisidoro/navi/pull/12 by @qubitrenegade
2019-09-23 09:05:47 -03:00
Denis Isidoro
b3f8e0b374
Improve test runner (#41) 2019-09-23 08:56:15 -03:00
Denis Isidoro
638a3d2fc9 Fix preview 2019-09-22 12:10:51 -03:00
Denis Isidoro
77acda383d
Add option for searching online repositories (#38) 2019-09-22 11:52:10 -03:00
Denis Isidoro
0df4b9123d
Fix linting (#30) 2019-09-21 19:24:09 -03:00
Denis Isidoro
44c4d9551f
Validate variable names (#29) 2019-09-21 19:21:46 -03:00
Denis Isidoro
d42d192bdd
Add preview window (#28)
Fix #21
2019-09-21 18:55:35 -03:00
Denis Isidoro
c8764ae224
Warn about fzf if not installed (#27)
Fix #13
2019-09-21 17:43:17 -03:00
Denis Isidoro
fd9d9974e7
Prevent printing result in some cases with --no-interpolation (#25)
Fix #19 and #11
2019-09-21 17:29:46 -03:00
Denis Isidoro
1a111a97d6
Fix indentation (#8)
The code was indented using `dot code beautify`

Related: https://github.com/denisidoro/dotfiles
2019-09-20 20:08:13 -03:00
Denis Isidoro
2bc52976c2
Add tests (#3) 2019-09-20 18:44:51 -03:00
Denis Isidoro
9cb06524c0 v0.5.0 2019-09-20 16:00:46 -03:00
Denis Isidoro
5a00cb4417
Improve README (#1) 2019-09-20 14:42:51 -03:00
Denis Isidoro
132aee10ce 0.3.0 2019-09-20 14:01:12 -03:00
Denis Isidoro
4c9f8ba2ff Move script 2019-09-20 10:59:53 -03:00
Denis Isidoro
588be03ae8 Make script executable 2019-09-20 10:40:00 -03:00
Denis Isidoro
3fd0e3f5cb First commit 2019-09-20 10:38:58 -03:00