This adds an option to the vento command which allows users to migrate
from the old history file to the newer database. It parses the history
file, writes the changes into the database, and then deletes the
previous file.
It works by showing n changes before and after the current position
in a table. Requires an 83+ column wide terminal. Command usage is
"vento -v [<n>]".
The new database system uses SQLite3, and allows users to move across
a linear history of their actions, including moving forward from a
previous action. Whenever a user runs a new action, the actions after
the current position within the history will be removed.
This was suggested by cargo-clippy. Instead of comparing against "",
it's better use the method is_empty() to determine if the dir argument
in the list() function is not empty.
Similarly to item actions, when the slot argument is not passed, it is
implied that the slot used is the active slot, therefore it is not
necessary to reiterate it.
It is implied that if you're working without the slot argument you are
working with the active slot, therefore it's not needed for the message
to output that.
This option is separate from the item actions, since it may be
important for some users to still see where the actions are being
undone. Therefore, I've added this option to a new hierarchy named
"history", which is why I've imported serde into the crate.
This has been an idea that has been on my mind for a bit. My argument
parser was very complex and hard to maintain. Therefore, I've decided
to refactor them using the Clap crate, which should make this more
straight forward.
I passed the file through rustfmt and rust-clippy in order to fulfill
some suggestions. Didn't do this before because I didn't have these
utilities in hand, but here we go!
This works using the override_color() function within common.rs, which,
using colored's set_override function and if set to false in the config
file, will disable all coloring within the program, in case your
terminal isn't that fancy.
Errors and messages will now be handled by a single module called
message.rs. This module has a new function called append_emoji(), which
will prefix emojis to each message. It also adds an enum named
EmojiType, which will contain each possible emoji prefix. Lastly, add
two new configs: "display_emoji" and "display_colors". "display_colors"
is yet to be implemented.
This happened to be an issue with the terminal I was using to test out
Vento. It would not space emojis correctly, causing them to require an
additional whitespace to be displayed correctly. Now that I've switched
terminals, it's now displayed as it really is: two whitespaces. Remove
the additional whitespaces I've accidentally added.
Since error refactoring was quite incomplete, I've added more errors for other parts of Vento. This should cover almost every error except slot errors, since those require their own formatting.
The only caveat is the limitations of the man library will not
allow me to write more in-depth documentation of the new flags. Maybe if
I go through refactoring the binary side using clap this will be easier.
This exports all contents in your vento directory into an xz tarball.
Needs documentation, but essentially it works using `vento -E`. Mind the
uppercase E there!
Currently undocumented, but this should allow users to export their
inventory slots as xz tarballs using `vento -e`. Ideal for sharing
collections of files to friends!
Since many of the errors were being reiterated in the files for the
binaries I've decided to refactor them so we borrow which errors we want
to show from an enum and then execute a function which essentially bails
and matches each error.
After the situation with the developers of Gitea wanting to privatize
their project and experiment with DAOs, I've decided to finally switch
to Sourcehut. The opinions on this forge are generally favorable, so I'm
hoping this will be for the best.
The slot switching action had a different emoji for confirming the
command was successful compared to other actions, so I switched it for
the green checkmark.
When undoing a slot switching command, it would show the message
normally show when running the command by itself, which is not supposed
to happen. This commit fixes that by adding a boolean argument that will
print the message when true.
Turns out the history didn't include undoing slot switching, so an
action could accidentally be undone in the wrong slot. I've fixed that
and also reorganized the source so undoing actions wouldn't be pegged to
the item module.