Commit graph

111 commits

Author SHA1 Message Date
Christina Sørensen
e6f597e08b
feat(git): add Commit, Add flags
This also fixes behaviour of all flags.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 10:52:23 +02:00
Christina Sørensen
d2353fe435
doc(git-cliff): added git cliff config
Just done using git cliff init. Does not introduce a dependency for
users.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 10:45:39 +02:00
Christina Sørensen
8476b343ec
chore: merge 0.0.6 #6 from cafkafk/dev
Of major notice is:
- Categories
- Repo flags
- Architectural overhaul
- Increased documentation
- Improved UX

- Changed config.yaml location
- Increased scope of push field
- Remove potentially destructive operation
- Fixed mini-license typos
- Fixed testing with hashmap arch
- Spinner on all repoactions
- Fixed commit in quick
- [**breaking**] Fixed quick, fast messages
- Fixed commit with editor regression

- Architectural Overview
- Moved charts to doc/img
- Update image locations
- Moved ARCHITECTURE.md to doc/
- Added some documentation
- Added roadmap

- Started flakification
- Added nix flake #5
- [**breaking**] Add push field
- [**breaking**] Add repo flags
- [**breaking**] Implemented naive categories
- Started work on using spinners
- Added pull flag
- React to exit code of git
- Started adding multi instruction logic
- Added fast subcommand

- Version bump to v0.0.3
- Moved install scripts to ./bin

- Fixed various clippy errors
- Removed unused code from flake
- Improved GitRepo assoc. function debug
- Removed redundant line in Cargo.toml
- Created on_all for config struct
- Naive nested hashmap
- Generic refactor

- Removed atty dependency

- Removed unused ./test dir

- Mvp flake working

<!-- generated by git-cliff -->

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 08:35:50 +00:00
Christina Sørensen
32f4f0a92a
chore: merge 0.0.6
Of major notice is:
- Categories
- Repo flags
- Architectural overhaul
- Increased documentation
- Improved UX

- Changed config.yaml location
- Increased scope of push field
- Remove potentially destructive operation
- Fixed mini-license typos
- Fixed testing with hashmap arch
- Spinner on all repoactions
- Fixed commit in quick
- [**breaking**] Fixed quick, fast messages
- Fixed commit with editor regression

- Architectural Overview
- Moved charts to doc/img
- Update image locations
- Moved ARCHITECTURE.md to doc/
- Added some documentation
- Added roadmap

- Started flakification
- Added nix flake #5
- [**breaking**] Add push field
- [**breaking**] Add repo flags
- [**breaking**] Implemented naive categories
- Started work on using spinners
- Added pull flag
- React to exit code of git
- Started adding multi instruction logic
- Added fast subcommand

- Version bump to v0.0.3
- Moved install scripts to ./bin

- Fixed various clippy errors
- Removed unused code from flake
- Improved GitRepo assoc. function debug
- Removed redundant line in Cargo.toml
- Created on_all for config struct
- Naive nested hashmap
- Generic refactor

- Removed atty dependency

- Removed unused ./test dir

- Mvp flake working

<!-- generated by git-cliff -->

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 10:32:07 +02:00
Christina Sørensen
6595bd5148
fix: fixed commit with editor regression
This allows committing with the users set editor, which is very handy if
you don't want to actually make meaningful commits.

This existed before, but implementing the instruction architecture for
composite actions broke it, because the status code refactor used
output() instead of status().

Thankfully, this does support exit codes still, but it does create some
cluttered output which is not terrible great UX, but this is not
extremely important, as this associated function isn't even currently
used by any user facing commands (except its explicit subcommand).

:D

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 10:20:42 +02:00
Christina Sørensen
25fe576052
fix!: fixed quick, fast messages
Fixed quick fast messages by "leaking" the memory for the input
effectively makiing it static.

This feel extremely hacky, and should never be used in a loop.

Consider this temporary until I find a better way, and or smart enough
people to tell me it's not as bad as I feel it is.

...Sorry Djikstra.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 09:52:56 +02:00
Christina Sørensen
df08a1ca2f
fix(main): fixed commit in quick
Fixed problem introduced by error handling.

This does not fix fast or fix lack of message input.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 09:25:00 +02:00
Christina Sørensen
e29cfa4866
sec: removed atty dependency
Cherry-picked from dev branch.

Updated pretty-env-logger to 0.5.0, as it was pulling atty which has a
potential security vulnerability, and further has been unmaintained and
unresponsive for 3 years.

https://github.com/advisories/GHSA-g98v-hv3f-hcfr

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 07:45:04 +02:00
Christina Sørensen
c6db4d5a3b
sec: removed atty dependency
Updated pretty-env-logger to 0.5.0, as it was pulling atty which has a
potential security vulnerability, and further has been unmaintained and
unresponsive for 3 years.

https://github.com/advisories/GHSA-g98v-hv3f-hcfr

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 07:25:11 +02:00
Christina Sørensen
7417a985c6
doc: added roadmap
Added a tentative roadmap for release 0.1.0 as well as a future planned
roadmap.

This is mostly to help myself not trying to add too many features in
between releases as dev is already far ahead of main.

Ideally, I'd like to iterate more rapidly on main. Given the basic
structure of the config is slowly stabilizing, this will be less painful

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-02 07:18:57 +02:00
Christina Sørensen
be0cbc8849
feat: added fast subcommand
As described in preceding commits.

Also added documentation changes that I forgot to add before amending to
previous commit :(

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-01 14:57:41 +02:00
Christina Sørensen
a52cc15f8e
doc: added some documentation
Not very much, just enough to not be literally nothing.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-01 14:45:23 +02:00
Christina Sørensen
3f05ae827a
feat(git): started adding multi instruction logic
This follows up on previous commits message, but with a completely
different implementation that is a lot tighter.

It doesn't handle commit messages, but quick is now implemented.

This has also shown that the previous fall-through behaviour of quick
wasn't a bug but a feature, as it would try to pull, not fail if it
couldn't.

This means it would be a good idea to implement an alternative version
of quick that keeps this old behaviour, or probably more likely,
creating a new command that does what the quick in this commit does, and
then finding a way to recreate the old behaviour of quick.

This is dev branch thou, so I don't have to do that before pushing :D

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-01 07:36:00 +02:00
Christina Sørensen
6d83d278e1
refactor(git): generic refactor
Started thinking about a new problem relating to how to deal with a
series of operations, as quick has been doing so far.

Now that we are trying to react to errors, it would be cool if we could
stop early, but this require maintaining a list of things that have
failed to avoid running them, and so we need to perform that logic
inside of the function (at least it's the more reasonable approach imo)

One way I can sketch rn might be to copy the hashmap structure of repos
as a reference, and then delete the references from our cloned map as
they fail. This is not ideal in any specific way, but it's a good first
approximation.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-01 06:18:02 +02:00
Christina Sørensen
e11efb3229
feat(git): react to exit code of git
Propagates the git exit code up through the layers, making the config
handle the actual errors at the output layer.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-07-01 06:02:01 +02:00
Christina Sørensen
301c604f37
feat(git): added pull flag
Added the pull flag to the repo logic.

Now you can pull only some repos.
2023-07-01 05:45:03 +02:00
Christina Sørensen
18e062010e
fix(git): spinner on all repoactions
Following up on previous commit, added spinner to all repo actions.

Also introduced on_all_spinner helper function, which is a version of
on_all, but intended for a single repo action (not a composed one like
quick), that takes care of managing the spinner.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-29 12:54:53 +02:00
Christina Sørensen
b6e04cf4a4
feat(git): started work on using spinners
Spinners are a blinking lights UX component. Ideally, a flag will be
added to run silently.

This only implements a sketch for using spinners when doing a quick
sync.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-29 12:05:59 +02:00
Christina Sørensen
58b9c50b83
doc(architecture): moved ARCHITECTURE.md to doc/
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-29 07:36:58 +02:00
Christina Sørensen
cacd073573
fix(tests): fixed testing with hashmap arch
Fixed tests to work with the new hashmap based architecture.

Introduced some handy helper functions in main.rs testing that I might
wanna move to the impl block of config later.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-29 07:28:50 +02:00
Christina Sørensen
fac64f5d11
refactor(test, git): naive nested hashmap
This is an implementation of the nested hashmap architecture, outlined
in architecture.md, however, with a hashmap instead of a btreemap.

This is ultimately just a sketch.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-27 11:56:04 +02:00
Christina Sørensen
6cebe88131
refactor(git): created on_all for config struct
This commit introduces on_all() on the config struct.

This unifies behaviour for iterating over all repos
in the config.

I'm introducing this to make testing various architectural
choices a breeze.

NOTE: Ideally, GitRepo should also be made generic, allowing
other types of repos at some point.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-27 11:03:20 +02:00
Christina Sørensen
d43abc0624
chore: moved install scripts to ./bin
Done this to preemptively declutter root dir.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-27 11:02:09 +02:00
Christina Sørensen
c48819aacb
doc: update image locations
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-27 10:56:33 +02:00
Christina Sørensen
3e8db4ce7d
doc(Architecture): moved charts to doc/img
Done this to preemptively declutter root dir.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-27 10:36:32 +02:00
Christina Sørensen
6c4af0413f
doc: Architectural Overview
I've started to document parts of the design process, mostly for my own
sake.

Having this around later will be helpful, and it also means I can point
smarter people here to quickly explain more complicated issues.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-26 11:15:20 +02:00
Christina Sørensen
3d3b6d6646
feat!: implemented naive categories
Naive category implementation.

Works somewhat, including part of tests.

However, I realize now that perhaps, having unique category names in
nescesarry for subcommands.

On the other hand, allowing them to be non unique would allow splitting
up category definitions.

But finding the category in a vec would be slow...

...and I want a lot of categories probably...

I'm still working on this... here is one way to do it ᕕ( ᐛ )ᕗ

Saved in the git log for posterity.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-24 10:30:36 +02:00
Christina Sørensen
bd9c85fb44
fix(strings): fixed mini-license typos 2023-06-22 16:14:53 +02:00
Christina Sørensen
56244f9d4f
feat!: add repo flags
Flags indicate what operations should be masked on a repo.

This is done in a way that is relatively more pleasurable to configure,
and should reduce the amount of breaking changes long term.

Overally, a very nice commit :D

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-22 15:54:45 +02:00
Christina Sørensen
720b9b0de1
fix: remove potentially destructive operaton
Commented out code that could potentially be destructive, right now it's
only a sketch, and if the unimplemented macro was removed one might be
mistaken thinking the associated function was intended for use.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-22 14:58:13 +02:00
Christina Sørensen
c104bfca8f
fix: increased scope of push field
The push field now disallows any quickpush related changes to the repo.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-22 14:37:16 +02:00
Christina Sørensen
4179384738
feat(git)!: add push field
Adding the push field to git repos, allowing to block gg attempting to push

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-22 14:31:21 +02:00
Christina Sørensen
90dfeb985a
fix: changed config.yaml location
Recent merge moved the location.

see: d61a46d4e5
2023-06-18 18:06:44 +00:00
Christina Sørensen
0739873dcc
feat: added nix flake #5
changelog:
- Refactor: Fixed various clippy errors
- Refactor: Fixed various clippy errors
- WIP: mvp flake working
- refactor: removed unused code from flake
- refactor: improved GitRepo assoc. function debug
- test: removed unused ./test dir
- refactor: removed redundant line in Cargo.toml
- chore: version bump to v0.0.3
2023-06-18 18:02:36 +00:00
Christina Sørensen
097e6fd798
chore: version bump to v0.0.3
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-18 19:57:13 +02:00
Christina Sørensen
30fe7943f1
refactor: removed redundant line in Cargo.toml
We only need one of license or license-file, so license-file was
removed.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-18 19:56:51 +02:00
Christina Sørensen
d61a46d4e5
test: removed unused ./test dir
The test dir was already copied into ./src/test, and this was redundant.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-18 19:44:45 +02:00
Christina Sørensen
5e974e213d
refactor: improved GitRepo assoc. function debug
Made the GitRepo associated functions easier to debug, by providing
additional output of the struct when running the git command on the repo
fails.

Also removed commented out code in main.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-18 19:39:50 +02:00
Christina Sørensen
cab7f72e28
refactor: removed unused code from flake
Most of this was introduced during the process of getting the flake to
work.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-18 19:34:51 +02:00
Christina Sørensen
551c406591
WIP: mvp flake working
This still has an issue, because tests cannot run with network inside of
the flake.

When this is solved, the code just needs to be refactored and it's
ready.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-17 14:11:42 +02:00
Christina Sørensen
ce2ceee129
feat: started flakification
The flake is still not fully functional.

First, it seems nescesarry to get a solid system for relative paths,
so that we can run tests inside of a nix build.

To iterate on this, use `nix flake check`.
2023-06-14 18:52:02 +02:00
Christina Sørensen
a9abc4fed5
Refactor: Fixed various clippy errors
It should be self evident from the diff what was changed and why.

This is to prepare for the flake-ification of the project.
2023-06-14 18:38:11 +02:00
Christina Sørensen
c507379f25
Added default to quick() in main #3
Added a default case to quick in main (quickcommit).
2023-06-12 11:54:58 +00:00
Christina Sørensen
1cc7f7a1ae
Added default to quick() in main
Added a default case to quick in main (quickcommit).

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-12 13:52:58 +02:00
Christina Sørensen
9182d4f236
Merge pull request #2 from cafkafk/dev
Refactored Links::link implementation to be able to deal with several possible scenarios:

    file already linked (happy case)
    link to different file exists
    non link file exists
    broken symlink exists
    no file exists (happy case)
    generic failure

Also attempted to make the code more readable than previous attempt. Admittedly, still needs some work.
2023-06-11 10:58:50 +00:00
Christina Sørensen
4a04b45b7b
Refactored Links::link implementation
Refactored Links::link implementation to be able to deal with
several possible scenarios:
- file already linked (happy case)
- link to different file exists
- non link file exists
- broken symlink exists
- no file exists (happy case)
- generic failure

Also attempted to make the code more readable than previous attempt.
Admittedly, still needs some work.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-11 12:54:14 +02:00
Christina Sørensen
c4f1543306
Merge pull request #1 from cafkafk/dev
License and license related flags
2023-06-09 16:36:30 +00:00
Christina Sørensen
696eacf8d7
bump to V0.0.2: license to license
Added licenses to files in src.

Implemented flags:
- warranty
- license

Added license notice to help.

Refactored parts of the code.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 18:31:22 +02:00
Christina Sørensen
0f7b525a55
Made -h, --help show license notice
Moved the help template into its own const, and concatenated it with the
interactive notice to append it to the help output.

Also, adjusted the license, warranty, and notice strings for increased
readability.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 18:28:19 +02:00
Christina Sørensen
c38b524e09
Finalized license, warranty flags
Made the clap Parser able to be run without a subcommand, by wrapping
the subcommand field of the Parser struct in an Option<Command>.

Further destructured the subcommand arms fields in main with Some(),
and made the default case None just return ().

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 18:16:28 +02:00