Commit graph

25 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Christina Sørensen
c8ea855451
Implemented the flag arms for license, warranty
Implemented the flag arms for license, warranty in main,
but this will not work before we make the clap Parser able
to be run without a subcommand, by wrapping the subcommand
field of the Parser struct in an Option<Command>.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 18:14:06 +02:00
Christina Sørensen
3e3566ea3c
Made utils/strings consts public
Made the following utils/strings consts public
- INTERACTIVE_NOTICE
- INTERACTIVE_LICENSE
- INTERACTIVE_WARRANTY

This is to allow their use in the flags match in main.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 17:30:42 +02:00
Christina Sørensen
db6e905cbc
Added arm to match statement for waranty in main
Added an arm to the match statement for parsing flags in main.

Using the pattern and hopefully ongoing convention of making
unimplemented arms indicated by using the unimplemented!() macro.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 17:25:15 +02:00
Christina Sørensen
9bbabb9367
Added --warranty flag, typos
Added the --warranty flag.

Removed part of docstring that said the --license would give full-text.
This is wrong, as will be implementing the shorter notice.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 16:25:25 +02:00
Christina Sørensen
661b730c44
Added licensing string constants to utils/strings
Added these three constants to utils/strings:
- INTERACTIVE_NOTICE
- INTERACTIVE_LICENSE
- INTERACTIVE_WARRANTY

These were based of the license text's notices for interactive programs,
found in the "How to Apply These Terms to Your New Programs" section.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 16:22:04 +02:00
Christina Sørensen
7c7d9f6129
Added GPLv3 header to files in src/
This is what the GPLv3 recommends, as can be referred in the LICENSE
file.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 16:09:32 +02:00
Christina Sørensen
e8dd2b177c
Init utils/strings module
For keeping longer text output helpers, such as e.g. license text and
CoC.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 16:01:26 +02:00
Christina Sørensen
7217c1cbfa
Removed commented out code in main.rs
For some reason, the match arm for --quick had only been commented out.
Now it's removed.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 15:57:34 +02:00
Christina Sørensen
eb92038fbf
Refactored GitRepo associated functions
Strings representing where to run commands where one of:

.current_dir(&(self.path.to_owned() + &self.name))
.current_dir(format!("{}{}", &self.path, &self.name))

Decided to change all instances to the latter, as asking people seemed
to prefer it for readability.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
2023-06-09 14:51:24 +02:00
Christina Sørensen
82089f213e
initial commit
History was reset for the first public release,
as the standard of commit messages would have set
a bad example...
2023-06-08 18:50:09 +02:00