Commit graph

319 commits

Author SHA1 Message Date
Juan Eugenio Abadie
43d16025d2 Reduce lines of code 2020-10-30 08:49:31 -03:00
Denis Isidoro
6dcbcfea54
Improve support for variable prompt in shell scripting (#428) 2020-10-15 15:44:56 -03:00
Denis Isidoro
648ebff1cd
Alfred workflow: fix quoting (#430) 2020-10-15 15:32:43 -03:00
Denis Isidoro
ca458f76f6
Fix autoselect-1 when using skim (#429) 2020-10-15 15:32:29 -03:00
Denis Isidoro
ff84a30301
Fix error when downloading repo using tab (#427)
Fixes #425
2020-10-13 10:05:07 -03:00
Denis Isidoro
9cf1227275
Fix trailing slash in $NAVI_PATH (#426)
Fix #420
2020-10-13 09:56:31 -03:00
Denis Isidoro
de06161baf
Fix support for fish shell (#421) 2020-10-08 17:45:01 -03:00
Denis Isidoro
5a758f00e1
Simplify hash code (#414) 2020-09-16 09:08:52 -03:00
Denis Isidoro
2868d178ed
Add navi info cheats-path command (#409) 2020-09-15 15:30:08 -03:00
Denis Isidoro
fa08d58706
Repo: add option for importing all files (#407) 2020-09-15 10:25:03 -03:00
Denis Isidoro
16e40ed128
Restart navi after adding a repo (#404) 2020-09-14 09:43:30 -03:00
Denis Isidoro
52b5271217
Make cheat finding recursive (#403) 2020-09-14 09:40:20 -03:00
Denis Isidoro
0e902d3230
Add ctrl-r binding for toggle-all (#402) 2020-09-14 09:06:29 -03:00
Denis Isidoro
1f37918142
Depend on directories-next instead of dirs (#400) 2020-09-14 08:53:53 -03:00
Denis Isidoro
6808dccf5c
Allow variable suggestions to use preview window (#399) 2020-09-14 08:48:57 -03:00
Denis Isidoro
566f7c9f2c Revamp preview window for argument selection (#398) 2020-09-11 11:59:34 -03:00
Denis Isidoro
e61e588b82
Improve documentation (#395) 2020-08-29 18:58:55 -03:00
Denis Isidoro
d79f181b4d
Fix alfred commands (#394) 2020-08-29 16:49:35 -03:00
Denis Isidoro
87eca1a0d0
Notify deprecation at most once (#393) 2020-08-29 15:53:28 -03:00
Denis Isidoro
a44eca3c9c
Unify code for finders (#392) 2020-08-29 15:46:16 -03:00
Denis Isidoro
ee17d79b71
Add tests for cheat.sh and tldr (#391) 2020-08-29 15:34:19 -03:00
Denis Isidoro
d64ec34912
Improve test coverage (#390)
- add test for tldr and cheatsh
- run all possible test cases
2020-08-28 09:58:35 -03:00
Denis Isidoro
2dd918d1e0
rustfmt: max-width 150 (#388) 2020-08-28 09:21:24 -03:00
Denis Isidoro
4ba0373790
Add initial support for cheat.sh and tldr (#387)
In order to browse cheatsheets from other projects.
2020-08-28 09:12:44 -03:00
Denis Isidoro
abae4e022f
Allow color and width customization (#386)
Fixes #202 and allows a workaround for #249.
2020-08-28 08:57:03 -03:00
Denis Isidoro
e49ff1a18d
Refactor code (#384) 2020-08-27 15:15:09 -03:00
Denis Isidoro
00fe27ba79
Add ability to extend cheatsheets (#382)
Fixes #377
2020-08-23 20:09:27 -03:00
Denis Isidoro
e64d1cc8aa
Multi-indexed variable map (#381)
This may be useful for future features
2020-08-19 09:00:06 -03:00
Denis Isidoro
657992b173
Allow implicit variable dependencies (#379)
* Allow implicit variable dependencies

* Aug-14 12h01: core.rs, Cargo.toml, Cargo.lock

* Aug-14 12h04: cases.cheat

* Aug-14 12h08: cases.cheat
2020-08-14 13:53:23 -03:00
Iain Earl
1d65f73994
Make --exact optional for skim by having --no-exact in the NAVI_FZF_OVERRIDES environment variable 2020-05-29 08:36:18 +01:00
Denis Isidoro
317cc34016
Change terminal fallback width to 80 2020-05-12 10:13:21 -03:00
Denis Isidoro
ead1323965
[Alfred] Add support for free input text (#354) 2020-04-25 22:26:39 -03:00
Denis Isidoro
0015d317b8
Improve code quality even more (#353) 2020-04-25 21:42:24 -03:00
Denis Isidoro
434fc4ac76
Improve code quality a little bit (#352)
Fixes #349
2020-04-25 15:30:05 -03:00
Denis Isidoro
818ebccdf0
Show icon in Alfred (#351) 2020-04-24 13:38:58 -03:00
Denis Isidoro
cc2007c674
Refactor variable dependency code (#350) 2020-04-20 18:29:48 -03:00
Denis Isidoro
c7f919eaa0
Add support for Alfred (#347) 2020-04-19 15:51:04 -03:00
Denis Isidoro
019adf82cf
Allow empty variables (#346)
Fixes #332
2020-04-18 08:06:05 -03:00
Denis Isidoro
d7d3321915
Prevent precocious abortion of url::open and clipboard copy (#345) 2020-04-16 10:39:42 -03:00
Denis Isidoro
17b9987886
Fix escaping issues in shell outs (#344) 2020-04-16 09:40:11 -03:00
Denis Isidoro
4853a6718c
Disable preview-window for variable suggestions (#343)
Fixes #338 

Reopens #320
2020-04-13 14:27:05 -03:00
Denis Isidoro
3188a76759
Prevent panic on empty tag/description (#341)
Fixes #339
2020-04-13 11:24:49 -03:00
Denis Isidoro
cbae8a5420
Attempt to fix git clone issues (#340)
Probably fixes #326
2020-04-13 10:31:33 -03:00
Denis Isidoro
4451624ce0
Show snippet in variable prompt (#337)
Fixes #320
2020-04-11 11:06:34 -03:00
Denis Isidoro
c6d17ca062
Shell out to git clone (#336)
Fixes #305
2020-04-11 10:14:04 -03:00
Denis Isidoro
6678cda032
Add support for post-choice manipulation (#335)
Fixes #325
2020-04-10 23:01:35 -03:00
Denis Isidoro
1f5db34902
Add support for copying snippet to clipboard (#334)
Fixes #205
2020-04-10 19:48:22 -03:00
Denis Isidoro
72cf882ee0
Handle spaces in fn url::open (#333)
Fixes #331
2020-04-10 19:21:14 -03:00
Denis Isidoro
d09fc850f1
Fix skim preview-window (#324) 2020-03-30 10:39:47 -03:00
Denis Isidoro
69ee79b272
Merge pull request #318 from shenek/skim-bin
Add support for skim binary instead of fzf binary
2020-03-30 10:19:11 -03:00
Stepan Henek
229ae72bbb
Add finder argument to choose between fzf and skim 2020-03-28 22:58:17 +01:00
Stepan Henek
5ab74c36c9
fixup! Add compile option to use skim binary instead of fzf binary 2020-03-27 22:24:36 +01:00
Stepan Henek
83a3286abe
Add compile option to use skim binary instead of fzf binary 2020-03-27 15:36:37 +01:00
Denis Isidoro
ec1ca87fa5
Fix snippet alignment + hide empty snippets (#316) 2020-03-26 14:14:56 -03:00
Denis Isidoro
2c705a05e6
Add colors to --help (#314) 2020-03-25 20:12:15 -03:00
Denis Isidoro
65154663db
Fix path error on initial run (#313)
Fixes #312 

This isn't idiomatic but it'll do for the time being
2020-03-24 11:42:18 -03:00
Denis Isidoro
04dcf79a34
Fix panic when trimming text with non-ASCII characters (#311)
Fixes #310
2020-03-24 10:53:45 -03:00
Denis Isidoro
4b5658a5b7
Fix crash when input has no match (#309)
Fixes #307
2020-03-24 09:42:54 -03:00
Csonka Mihaly
53c69aa72c Fix unnecessary allocations when reading file. 2020-03-23 17:16:13 +01:00
Csonka Mihaly
8c4100abea Potentialy fix error string creation to only be done when needed. 2020-03-23 17:04:32 +01:00
Csonka Mihaly
f214a561b8 Remove unneeded mut 2020-03-23 16:38:01 +01:00
Csonka Mihaly
80621dba78 Merge remote-tracking branch 'upstream/master' into improve-error-handling 2020-03-23 00:25:28 +01:00
Csonka Mihaly
ed8e3e43c3 Add context to file copy when pulling cheatsheets from a repo. 2020-03-23 00:24:35 +01:00
Csonka Mihaly
ec0bbf4e76 Fix remove dir panicing when the dir does not exist, but when the purpose is to make place for a replacement. 2020-03-22 23:50:44 +01:00
Csonka Mihaly
09dfc32d2c Fix "file an issue" error 2020-03-22 23:38:06 +01:00
Csonka Mihaly
4bc9b00a52 Add wrapper error telling the user to file an issue 2020-03-22 23:32:03 +01:00
Csonka Mihaly
a625b0aea0 Fix welcome command 2020-03-22 22:54:02 +01:00
Csonka Mihaly
4bfc2e5a6c Add BashSpawnError 2020-03-22 22:16:30 +01:00
Csonka Mihaly
5d2c2aca80 Add UnreadableDir error. 2020-03-22 21:08:04 +01:00
Csonka Mihaly
11575a8443 Restructure error module 2020-03-22 20:47:13 +01:00
Csonka Mihaly
4bbccc2cfa Add InvalidPath error 2020-03-22 20:14:10 +01:00
Csonka Mihaly
5c44bba2bf Fix error message for absense of cheatsheet dir 2020-03-22 17:33:23 +01:00
Csonka Mihaly
800a7e61a7 Added backticks around variable data in error info. Less ambiguous when input is empty. 2020-03-22 16:31:49 +01:00
Denis Isidoro
8c3748f997
Fix --preview-window for repo browse (#302) 2020-03-22 10:14:47 -03:00
Csonka Mihaly
3c5d5aba98 Fix parsing of paths param with trailing colon to not yield an empty item + add test for this 2020-03-22 02:53:40 +01:00
Csonka Mihaly
a4c30d7439 Make shell handler return an anyhow::Error. 2020-03-22 01:54:04 +01:00
Csonka Mihaly
07509ddcd7 Add error context to parser. 2020-03-22 01:51:38 +01:00
Csonka Mihaly
c1c5910cf4 Make error info for cheatsheet paths acquisition more verbose. 2020-03-21 19:35:54 +01:00
Csonka Mihaly
1c22e11e09 Add error info to fzf. 2020-03-21 19:01:58 +01:00
Csonka Mihaly
a4e2311263 Add error info to filesystem operations. 2020-03-21 17:43:13 +01:00
Csonka Mihaly
ff264735b9 Add error info to core flow. 2020-03-21 15:56:03 +01:00
Csonka Mihaly
807c3a35a5 Make all regexes static. 2020-03-21 03:22:11 +01:00
Csonka Mihaly
0785f9cf30 Add error info for invalid regex. 2020-03-21 02:52:27 +01:00
Csonka Mihaly
d371300fac Add error info when getting terminal dimensions. 2020-03-21 02:49:36 +01:00
Csonka Mihaly
77d0de839e Fix error message when spawning bash in func. 2020-03-21 02:37:54 +01:00
Csonka Mihaly
a209dd94ca Add error info for welcome handling. 2020-03-21 02:19:06 +01:00
Csonka Mihaly
54fec8728e Add error context to ad-hoc functions. 2020-03-21 02:12:39 +01:00
Csonka Mihaly
0a84a0a2c9 Add error info to preview::extract_elements 2020-03-21 01:43:11 +01:00
Csonka Mihaly
f1182279a9 Add context to possible errors for the repo subcommand. 2020-03-21 01:34:20 +01:00
Csonka Mihaly
1d33211c45 Add context for errors when browsing featured cheatsheets. 2020-03-20 23:24:43 +01:00
densa-inc
c12c2abc69 fixed issue of terminal programs like fzf not recognizing stdin as terminal (#267) 2020-03-20 15:33:36 +01:00
Denis Isidoro
10f0219792
Forward many more parameters to fzf after --- (#294) 2020-03-19 22:01:50 -03:00
Denis Isidoro
64045e32ca
Remove need for lifetime on FzfOpts (#293) 2020-03-19 20:50:45 -03:00
Denis Isidoro
73cd346c1b
fzf-overrides: no need for leading space 2020-03-19 15:27:34 -03:00
Denis Isidoro
2ca1d8fc85
Fix --multi with --column + refactors (#290) 2020-03-19 09:19:50 -03:00
Denis Isidoro
84e28e7885
Small refactors (#289) 2020-03-18 12:29:29 -03:00
Denis Isidoro
a0bba94db3
Minor fixes (#285) 2020-03-18 08:38:13 -03:00
Kevin K
a51a54dbac
Uses a hashset to de-duplicate results
This creates a `HashSet<u64>` using FNV Hashing, because it's much
faster than Rust's default SIP hash and this isn't used for anything
that needs to be cyptographically secure. It also allows us to keep a
hashset of 64bit numbers, instead of Strings or string slices thus
reducing memory consumption.

In unscientific benchmarks of ~5,200 `.cheat` lines containing about
`2,600` duplicate lines there was no noticable increase in memory
consumption (benchmarking time is harder since you wait for human
input), both master (HEAD b78903a9d4) and this commit used 10.8mb max
RSS.

To attempt to measure time (and again max RSS) running master against
this commit using the command `navi --print --path dups_folder/ best "git tag"`
resulted in a *decrease* of memory consumption by about 200k, and no
noticable time increase.

Closes #283
2020-03-17 21:39:00 -04:00
Denis Isidoro
b49ee6a491
Make --allow-extra default (#281) 2020-03-17 12:39:38 -03:00
Denis Isidoro
0b91a374fe
Add navi repo browse (#280) 2020-03-16 22:56:47 -03:00
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