Commit graph

195 commits

Author SHA1 Message Date
Artturin
995b210e86 v2.3.3 2025-07-29 15:52:51 +03:00
Artturin
0009f37aa2 Install handlers in a location where they won't be autoloaded 2025-07-29 15:51:05 +03:00
Artturin
6f2e7c6306 Revert "Remove command-not-found handlers, will be readded in a module"
This reverts commit 76a9931873.
2025-07-29 15:37:33 +03:00
Artturin
6c400809d6 v2.3.2 2025-07-29 15:30:58 +03:00
Artturin
76a9931873 Remove command-not-found handlers, will be readded in a module 2025-07-29 15:27:35 +03:00
Artturin
28dcca3e5a v2.3.1 2025-07-29 14:26:59 +03:00
Artturin
a209c1323d Move mangen above cache
It's run in the build so there can be permission issues with cache
creation resulting in a warning.
2025-07-29 14:25:31 +03:00
Artturin
d891aa321f Fix fish comma-command-not-found 2025-07-29 14:24:04 +03:00
Artturin
c11a8b4944 Include cache path in error 2025-07-28 21:10:49 +03:00
Artturin
ad0b489b9e Use error macro in a few places 2025-07-28 21:05:37 +03:00
Ross Smyth
393f20bc88
Allow user to generate the man page (#108) 2025-07-26 18:11:41 +03:00
Artturin
dcf5563721 v2.3.0 2025-07-24 21:16:42 +03:00
Ross Smyth
9974dd514c
Add Fish and Nushell command-not-found handlers (#104) 2025-07-23 15:15:10 +03:00
Artturin
d97c12ab9e
Merge pull request #107 from RossSmyth/pathClean 2025-07-23 15:12:19 +03:00
Ross Smyth
8ef7130d46 Replace wrapProgram with substituteInPlace so PATH isn't polluted
Previously, when a command was executed with `, blah`,
it would inherit the $PATH var from comma. This meant
that there was some slight pollution, primarily since
it would be the `nix`, `fzy`, and `nix-index` bin paths
on PATH. Specifically they would be prefixed, so they would
override any other entries. This could lead to confusing
behavior if comma is built from a flake without overriding
the nixpkgs input.

This changes it so that the paths are directly embedded
in the binary, so no PATH pollution occurs.
2025-07-22 16:41:48 -04:00
Artturin
4bc672b803 v2.2.0 2025-07-19 15:02:36 +03:00
Artturin
582fa11586 cargo clippy --fix 2025-07-19 15:01:29 +03:00
Artturin
ca003ff5e6 flake.lock: Update
Flake lock file updates:

• Updated input 'naersk':
    'github:nix-community/naersk/0473954e399eec0081ee816f3430c17d1f7e5a42?narHash=sha256-QNo234SxSB2lLavaT2d%2Bg%2BZ2WB7o7w29vYkM6zfRLi4%3D' (2025-07-07)
  → 'github:nix-community/naersk/0e72363d0938b0208d6c646d10649164c43f4d64?narHash=sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc%3D' (2025-07-16)
• Added input 'naersk/fenix':
    'github:nix-community/fenix/bf0d6f70f4c9a9cf8845f992105652173f4b617f?narHash=sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU%3D' (2025-07-14)
• Added input 'naersk/fenix/nixpkgs':
    follows 'naersk/nixpkgs'
• Added input 'naersk/fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/591e3b7624be97e4443ea7b5542c191311aa141d?narHash=sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu%2BQEnJn2Sfg%3D' (2025-07-13)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9b008d60392981ad674e04016d25619281550a9d?narHash=sha256-mgFxAPLWw0Kq%2BC8P3dRrZrOYEQXOtKuYVlo9xvPntt8%3D' (2025-07-08)
  → 'github:NixOS/nixpkgs/8131c0ea9df6293a247be743a387ff725e464db7?narHash=sha256-pGvcN/yiJ4e3/hgvTwkyZvl6c3HuLLCY/hjEzDuQB54%3D' (2025-07-18)
2025-07-19 14:59:03 +03:00
Artturin
f90146b546
Merge pull request #103 from culxttes/nix-locate-top-level
feat: remove "top-level" argument of "nix-locate"
2025-07-19 13:48:57 +03:00
Artturin
4d9c93a0c4
Merge pull request #85 from Pandapip1/command-not-found-handle 2025-07-18 12:57:43 +03:00
Artturin
8767be1ae3 Rename comma-command-not-found.sh 2025-07-18 12:53:19 +03:00
Culottes
2dab620c7a
feat: remove "top-level" argument of "nix-locate" 2025-07-18 08:48:21 +02:00
Artturin
5f5499610e Add --ask for use in command-not-found 2025-07-15 20:50:11 +03:00
Gavin John
c89af24f00 Add command-not-found handler 2025-07-15 19:02:05 +03:00
Artturin
27ce74dda2 v2.1.0 2025-07-14 01:57:28 +03:00
Artturin
7c120ad582 Make comma overrideable 2025-07-13 21:03:02 +03:00
Artturin
1f6804946d Add formatter attr 2025-07-13 20:28:06 +03:00
Artturin
8c5b3898d1 Format 2025-07-13 20:27:22 +03:00
Artturin
4d64424458
Merge pull request #102 from thiagokokada/cache-settings 2025-07-13 20:20:42 +03:00
Thiago Kenji Okada
fd8adc78e8 Update README.md with cache instructions 2025-07-12 13:01:11 +01:00
Thiago Kenji Okada
febd4fc25d Add --cache-level flag
This is u8 flag that accepts the following options:
- 0: completely disables caching
- 1: only cache choices
- 2: also caches paths

Setting the default to 2 to keep the current behavior.

Fixes: #90.
2025-07-12 12:51:39 +01:00
Thiago Kenji Okada
d98bc3269f Print path for debug in Cache::new() 2025-07-12 12:37:49 +01:00
Thiago Kenji Okada
61f57140a8 Document missing flags 2025-07-12 12:10:20 +01:00
Artturin
98736ccbdf Remove missed --update reference 2025-07-12 00:52:14 +03:00
Artturin
867a9f37f4 cargo fmt 2025-07-11 16:52:21 +03:00
Artturin
242cdfcea8 Remove deprecated feature --update 2025-07-11 16:52:14 +03:00
Artturin
8ca7dabea8 Add quotes release.sh 2025-07-11 16:16:00 +03:00
Artturin
9551b0d484 v2.0.0 2025-07-11 13:53:35 +03:00
Artturin
3d3dc5d885 "Fix" unused return value of std::os::unix::process::CommandExt::exec that must be used 2025-07-11 13:41:15 +03:00
Artturin
8e5a0b68e1 cargo clippy --fix 2025-07-11 13:33:09 +03:00
Artturin
b750419664 cargo update & cargo upgrade 2025-07-11 13:27:35 +03:00
Artturin
18b3455673 flake.lock: Update
Flake lock file updates:

• Updated input 'flake-compat':
    'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04)
  → 'github:edolstra/flake-compat/9100a0f413b0c601e0533d1d94ffd501ce2e7885?narHash=sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX%2BfjA8Xf8PUmqCY%3D' (2025-05-12)
• Updated input 'naersk':
    'github:nix-community/naersk/3fb418eaf352498f6b6c30592e3beb63df42ef11?narHash=sha256-r/xppY958gmZ4oTfLiHN0ZGuQ%2BRSTijDblVgVLFi1mw%3D' (2024-07-23)
  → 'github:nix-community/naersk/0473954e399eec0081ee816f3430c17d1f7e5a42?narHash=sha256-QNo234SxSB2lLavaT2d%2Bg%2BZ2WB7o7w29vYkM6zfRLi4%3D' (2025-07-07)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/b833ff01a0d694b910daca6e2ff4a3f26dee478c?narHash=sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w%2BROpMfuw%3D' (2024-09-01)
  → 'github:NixOS/nixpkgs/9b008d60392981ad674e04016d25619281550a9d?narHash=sha256-mgFxAPLWw0Kq%2BC8P3dRrZrOYEQXOtKuYVlo9xvPntt8%3D' (2025-07-08)
• Updated input 'utils':
    'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a?narHash=sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ%3D' (2024-03-11)
  → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13)
2025-07-11 13:19:11 +03:00
Artturin
cc78f61726
Merge pull request #101 from thiagokokada/implement-eval-cache 2025-07-11 13:13:47 +03:00
Thiago Kenji Okada
c4d04f7373 Use nix build in get_command_path instead of hack around nix shell 2025-07-08 22:59:30 +01:00
Thiago Kenji Okada
b96f3eeb27 Reduce copies 2025-07-08 11:38:29 +01:00
Thiago Kenji Okada
9df8f0c1ef Add some basic logging for caching
Can be enabled with `export RUST_LOG=debug` or `export RUST_LOG=trace`
2025-07-08 09:36:06 +01:00
Thiago Kenji Okada
25e3004217 Support cache for path in --print-path 2025-07-07 23:00:23 +01:00
Thiago Kenji Okada
a79fa651f0 Move state file from $XDG_STATE_HOME/comma-choices to $XDG_STATE_HOME/comma/choices
This is because the recent changes in the cache made the old format
incompatible with the new one, but also because this is more inline
with XDG Base Directory specs.
2025-07-07 18:03:49 +01:00
Thiago Kenji Okada
23fb608731 Implement cache for path
Instead of only caching the derivation name, in this PR we also cache
the path from the derivation itself. This result in much faster
subsequent runs:

Before:

```
$ hyperfine "./result/bin/comma ls"
Benchmark 1: ./result/bin/comma ls
  Time (mean ± σ):     990.1 ms ±  94.5 ms    [User: 368.8 ms, System: 129.8 ms]
  Range (min … max):   900.8 ms … 1212.4 ms    10 runs
```

After:

```
$ hyperfine "./result/bin/comma ls"
Benchmark 1: ./result/bin/comma ls
  Time (mean ± σ):      29.4 ms ±   5.7 ms    [User: 10.5 ms, System: 4.8 ms]
  Range (min … max):    10.8 ms …  50.3 ms    56 runs
```

All runs done in macOS (15.5), I expect the results to be even better on
Linux.
2025-07-07 18:03:49 +01:00
Thiago Kenji Okada
c32f2527fc Fix clippy warning 2025-07-07 14:14:45 +01:00