Hi!
I've been trying to get atuin set up on the illumos machine I built for work
@oxidecomputer, and I ran into a few issues which are fixed here:
1. The `clipboard` feature was only supported on Windows, Mac and Linux. I've
added a platform gate for that.
2. The `atomic-write-file` crate needed an update to the version of `nix` --
that is included.
3. As part of this, I found a [security
bug](https://rustsec.org/advisories/RUSTSEC-2024-0020.html) in the whoami
crate. The bug has been fixed upstream and I've included it.
whoami 1.5.0 deprecates the `hostname` function, which produced some fresh
warnings. While fixing the warnings I also took the liberty of doing some
code rearrangement, adding a few functions that wrap some common operations. I
didn't really know where to put those functions, so I created a new `utils`
module for it. If you have a better place to put them, I'm happy to change
the PR.
Feel free to make any changes to this PR if you like before landing it, or to
ask for review.
As a followup I'm also happy to set up a cross-compile build for atuin on
illumos. It's a bit harder to run tests in CI for illumos at the moment, but
I'm trying to get a project started up to make that happen in the future as
well.
* feat(stats): add linux sysadmin commands to common_subcommands
I've been using atuin on my Linux box for some time now and I have
noticed that a few commands that are used rather often are not in the
list of common_subcommands.
This change adds these commands to the list.
* feat(stats): I forgot 'apt'
* Normalize formatting
This makes the commented bits unifed and makes lists multiline and
always adds the trailing comma.
* Add nix to default config
Since we are big fans of it ;)
* fix(import/zsh-histdb): import exit_status and session
* fix(import/zsh-histdb): avoid session id conflict
* fix(import/zsh-histdb): follow the format conventions of session and hostname
* fix(import/zsh-histdb): duration unit is nanosecond
* feat(client): add config option keys.scroll_exits
If the config option is set the `false`, using the up/down key won't
exit the TUI when scrolled past the first/last entry.
Example:
```
[keys]
scroll_exits = false
```
The default is `true`, which is the current behavior.
* Update atuin/src/command/client/search/interactive.rs
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
* refactor: add option to config.toml
---------
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
* add xonsh to `atuin import auto`
* respect $HISTFILE in xonsh importers
* disable up-arrow binding in xonsh when completion menu is active
* include xonsh logic in the same conditional as other shells
* format and fix clippy lints
* add importers for xonsh JSON files and SQLite db
* rustfmt xonsh importers
* remove env-dependent tests from xonsh importers
* pass xonsh_data_dir into path resolver instead of looking up in env
* review: run format
* review: fix clippy errors
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Instead of lots of small sqlite transaction, do one monster one.
A single tx with 100s of 1000s of rows should be fine on all systems
A very unscientific test shows this to be roughly 10x faster
Low-end devices like RISC-V SBCs are sometimes too slow to initialize SQLite in 0.1s. Option to specify a higher value allows check to pass on such devices with relaxed restrictions.
Replace lots of logging with some progress bars. This looks much nicer
I'd like to move it out of the atuin-client crate and into the atuin
crate. But first, I want to decouple a lot of the record moving, so it
can wait until that's done.
* Allow specifying a timezone in history search/list
* Fix clippy complaints
* Add a bit more comment on supporting named timezones
* Add rudimentary tests
* Ditch local timezone test
* Timezone configuration support
* Set default timezone to `local`
* `--tz` -> `--timezone`
`--tz` is kept as a visible alias
This allows the user to
1. Specify that they want to sync, but ONLY pull new data
2. Specify that they wish to force pull, which will wipe the local store
and download it from the remote
With the other set of changes, this allows the user to perform
sufficient maintenance to recovery from most errors I can think of right
now.
This will
1. Wipe the remote store
2. Upload all of the local store to remote
Imagine the scenario where you end up with some mixed keys locally :(
You confirm this with
```
atuin store verify
```
You then fix it locally with
```
atuin store purge
```
Ensure that your local changes are reflected remotely with
```
atuin store push --force
```
and then (another PR, coming soon), update all other hosts with
```
atuin store pull --force
```
This command will delete all records from the local store that cannot be
decrypted with the current key.
If a verify fails before running this, it should pass _after_ running
it.
Required afterwards:
- A `push --force`, to allow ensuring the remote store equals the local
store (deletions have now occured!)
- A `pull --force`, as once remote has been forced then local needs the
same
Nice to have:
- Provide "old" keys to purge, in case the are not lost. Or maybe rekey.
This ensures that the local store can be decrypted with the current
in-use key.
If it cannot, we can go on to perform maintenance operations and get
back into a happy state.
* feat: add prefers_reduced_motion flag
* use NO_MOTION, and ensure type is bool
* update default config
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
* feat: add record re-encrypting
* automatically re-encrypt store when logging in with a different key
* fix
* actually save the new key lmao
* add rekey
* save new key
* decode bip key
* "add test for sqlite store re encrypt"
Now that local history is stored encrypted, new_key should not overwrite
an existing one. This may be frustrating, but will remove the risk of
Atuin generating a new key and the user losing their old one.
* add support for getting the total length of a store
* tidy up sync
* auto call init if history is ahead
* fix import order, key regen
* fix import order, key regen
* do not delete key when user deletes account
* message output
* remote init store command; this is now automatic
* should probs make that function return u64 at some point
* Add change-password command & support on server
* Add a test for password change
* review: run format
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
* feat: make history list format configurable
* Update atuin-client/config.toml
* review: run format
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
* chore: add feature to allow always disable check update
In the packaging rules of some distributions, the software's self-update check needs to be permanently turned off
This commit will make it easier for these users to
* fix: formatting
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
An issue with the old sync was that if there was _one_ record encrypted
with a different key, sync would stop. You'd need to delete your account
and start from scratch. This sucked.
This change means we will carry on, and try to encrypt and build with as
much of the history as we are able to decrypt.
This is possible because we can quite happily store data on disk that we
cannot decrypt. The old store couldn't do this.
In future, we might consider a keyring containing multiple keys.
Related: https://forum.atuin.sh/t/search-ignoring-commands/74/5?u=ellie
When a user ran a duplicated command, but in another session, it was
removed by filters. This is because the subquery that was once used did
not have the same filters applied as the main query.
Instead of messing with subqueries, `group by` instead. This aligns with
the search() function
* feat(search): make cursor style configurable
The vim mode of the interactive Atuin search changes the cursor style
on a mode change, but the current implementation has the following
issues.
* The terminal's cursor style set by the Atuin search remains after
Atuin exits. This causes an inconsistency with the shell's setting
for the cursor style.
* Also, the cursor style for each keymap mode is currently hardcoded
in the source code, which is not necessarily consistent with the
user's cursor-style setting in the shell.
* Since the current implementation does not set the cursor style for
the initial keymap mode but only sets the cursor style when the
keymap mode is changed, it also causes inconsistency in the cursor
style and the actual keymap when the shell's keymap and Atuin's
initial keymap mode are different.
This patch solves those issues by introducing an opt-in configuration
variable `keymap_cursor`. By default, the vim mode does not change
the cursor style because there is no way to automatically determine
the cursor style consistent with the shell settings. We enable the
feature only when the user specifies the preferred cursor style in
each mode in their config. Also, the cursor style is set on the
startup of the Atuin search (based on the initial keymap mode) and is
reset on the termination of the Atuin search (based on the shell's
keymap mode that started the Atuin search).
* chore(settings): remove dependency on crossterm
* fix: add acquire timeout to sqlite database connection
This should fix#1503
I wasn't able to trigger enough IO pressure for the SQL connection to be
a problem.
This adds `local_timeout` to the client config. This is a float, and
represents the number of seconds (units in line with the other timeouts,
though those are ints). Users may well want to reduce this if they
regularly have issues, but by default I think 2s is fine and avoids a
non-responsive system in bad situations.
* tests
When printing the history list with either the session or cwd filter
enabled, use to same query method as without either to ensure that the
other options (hide deleted entries etc) are respected.