Commit Graph

628 Commits

Author SHA1 Message Date
aawsome
dea0221b38
feat(commands): Add tar output to dump command (#1328)
The `dump` command will now produce a tar when called with a directory.

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-24 19:05:00 +02:00
simonsan
a6a135a649
chore(deps): update tokio, ratatui, and tui-textarea (#1336)
chore(deps): update dependencies: tokio, ratatui, and tui-textarea
fix(clippy): use of deprecated method `ratatui::widgets::Table::<'a>::highlight_style`: use `Table::row_highlight_style` instead
2024-10-24 19:01:46 +02:00
simonsan
4ba226a7f3
chore(deps): update abscissa framework (#1330) 2024-10-24 18:21:05 +02:00
aawsome
d52f481be8
fix: clippy lints for new Rust version (#1329)
Fix clippy lints which came from updated Rust version. We now use `Box`
for all commands.
2024-10-20 12:37:03 +00:00
simonsan
64e1ebb5ba
chore(deps): update rustic_core (#1309)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-09 18:43:47 +02:00
aawsome
cb3903b9dc
feat(config): Add hooks (#1218)
This PR adds `run-before`, `run-after`, `run-failure` and `run-finally`
hooks for:
- all commands in the `[global.hooks]` config profile section
- commands accessing the repository in the `[repository.hooks]` config
profile section
- the `backup` command specifically in the `[backup.hooks]` config
profile section
- specific backup sources in the `[backup.snapshots.hooks]` section

Note: This PR includes only calling the given commands. If there is the
wish for supplying information to the commands (env variables or
parameter substitution), this should be covered by a separate feature
request/PR.

closes #902

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-05 01:58:55 +00:00
aawsome
cc4f016dab
feat(config): add more filters (#1263)
Adds the following filter options:
- `filter-paths-exactly` - filters exactly the given pathlists
(supersets don't match)
- `filter-tags-exactly` - filters exactly the given taglists (supersets
don't match)
- `filter-before` - filters by time (date or date+time can be given)
- `filter-after` - filters by time (date or date+time can be given)
- `filter-size` - filters by size of snapshot'ed data (upper and lower
limit may be given)
- `filter-size-add` - filters by size added to the repository (upper and
lower limit may be given)

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 22:57:21 +00:00
aawsome
68cbca3ee4
perf(interactive): use update methods for refreshing snapshots (#1285)
This increases speed of refreshing a lot.
2024-10-02 21:30:54 +00:00
aawsome
2b8ee0f2e6
feat(check): Allow to only check trees+packs for given snapshots (#1230)
see #251

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 18:31:18 +00:00
simonsan
238ae99450
fix(docs/cli): improve the descriptions of the CLI commands (#1277)
Fixed the capitalization of `dump` for the dump command, and then
figured, that there might be some better descriptions for other commands
as well.

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 13:45:43 +00:00
simonsan
ec6165a25e
fix(deps): update rustic_core and other dependencies and fix merge precedence (#1282)
Due to changes in the way how merging of values were applied to
configuration values in `BackendOptions` this should is considered a
fix. Now values from the configuration file don't overwrite values from
environment variables, any more. As it was intended and stated in the
documentation.

Please make sure, your workflow is still working as intended, especially
that the configuration values and environment variables are applied as
you wanted it and as we documented it in the Configuration
documentation.

Precedence also applies when inheriting options from other profiles
using `use-profiles` or when using multiple profiles, e.g. `rustic -P
one -P two`. If the same repository option is defined in `one` and `two`
the value of `one` is taken. Before the fix, the value of `two` was
taken. But the fix only applies to the repository options. For other
options, `one` always had precedence.

Fixes #1226

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: Alexander Weiss <alex@weissfam.de>
2024-10-02 13:43:11 +00:00
simonsan
fbf4c2edfa
feat(commands): add a docs command to easily access the user, dev and config documentation (#1276)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 07:15:34 +00:00
aawsome
5ec9652511
feat(commands): Add list indexpacks and list indexcontent commands (#1254)
This allows better analysis of reported bugs related to the index.
2024-09-24 00:36:45 +02:00
aawsome
f5499db21b
perf: Reduce memory usage of restore (#1069)
reduce memory usage of the `restore` command by removing the data
entries from the index before doing the actual restore.

see https://github.com/rustic-rs/rustic/issues/1067

TODO:
- [x] remove Cargo changes once
https://github.com/rustic-rs/rustic_core/pull/166 is merged
2024-09-23 19:54:28 +00:00
aawsome
4c4e820400
chore: Update to newest rustic_core (#1248)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-23 21:34:51 +02:00
aawsome
49e12a5af6
feat(commands): Add option --only-identical for diff to allow for bitrot check (#1250)
see https://github.com/rustic-rs/rustic/discussions/1246

Discussion: Is `--only-identical` a good name?

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-23 15:07:20 +00:00
aawsome
86fa8551f4
fix(config)!: use multiple options only as array in config profile (#1240)
Consistently uses singular and plural names for options in config and
CLI

BREAKING CHANGE: This requires to adapt CLI calls and config keys.

Affected options:
- `glob` -> `globs` in config profile
- `iglob` -> `iglobs` in config profile
- `glob`-file -> `glob-files` in config profile
- `iglob-file` -> `iglob-files` in config profile
- `custom-ignore-file` -> `custom-ignore-files` in config profile
- `tag`-> `tags` in config profile
- `keep-tags` -> now only array
- `keep-ids` -> now only array
- `use-profile`-> `use-profiles` in config profile
- `backup.sources` -> `backup.snapshots` in config profile
- `filter-host` -> `filter-hosts` in config profile
- `filter-label` -> `filter-labels` in config profile

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-23 15:04:45 +00:00
aawsome
14e4c66edb
fix(interactive): Allow snapshots to be modified and marked to forget (#1253)
closes #1252
2024-09-23 14:49:39 +00:00
Krzysztof Małysa
7421d0acf3
fix: make ls and find show the year of mtime date (#1249)
Fixes #1239

Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
2024-09-22 21:09:46 +00:00
Krzysztof Małysa
63d5f166cd
feat(commands): ls: Add option --json (#1251)
Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
2024-09-22 21:03:29 +00:00
Krzysztof Małysa
a21c991b33
fix: ls: Remove printing trailing space (#1247)
Paths are separated by a newline, printing space only hinders parsing.
Also paths are now displayed using `Path::display()`.
2024-09-21 22:35:45 +00:00
aawsome
ee6380e0b3
feat(commands)!: copy: Use config profile as target (#1131)
Breaking change: Targets for the `copy` command must now be given by
using config profile(s).

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-18 19:10:36 +00:00
aawsome
959c0576bc
feat(commands): backup: Add option --long (#1159)
closes #1156

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-18 19:04:55 +00:00
nardoor
b865901a0c
fix: webdav/forget: correctly use application config (#1241)
The `inner_run` implementation used `self`
to read its config when it should use `RUSTIC_APP.config()`.

Some might say this is counterintuitive.
fixes #1163
also now correctly respects having `prune = true` in the config profile.

---------

Co-authored-by: Alexander Weiss <alex@weissfam.de>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-09-18 14:42:18 +00:00
Marti Raudsepp
abf1835cbd
doc: update RepositoryErrorKind rustdoc following rustic_core change (#1237)
Companion PR for https://github.com/rustic-rs/rustic_core/pull/265

It renames `PasswordCommandParsingFailed` to
`PasswordCommandExecutionFailed`
2024-09-13 22:04:28 +02:00
aawsome
740cb4699d
feat(interactive): Allow to view text files (#1216)
Adds the possibility to view text files up to 1MiB in the interactive
snapshot tree view. Note this is a quick-and-dirty implementation which
could be improved better non-text-files and which could be optimized to
read files of all sizes
2024-09-08 17:32:44 +00:00
aawsome
12660103a9
feat(interactive): Allow to modify filters (#1210)
Adds the possibility to edit the filter used in the interactive
snapshots view:
- use 'V' to view or change the filter
- use 'Ctrl-v' to reset to the filter as given to the command

---------

Co-authored-by: nardor <nard0r@protonmail.com>
2024-09-08 17:31:28 +00:00
aawsome
ffe05f58d0
fix: return exitcode (#1220)
rustic now returns an error code for failing command.

Note: Some command do not fail yet fail in every cases user would expect
is. Most notably the `check` ckommand producing `error` messages may
still return error code 0.

closes #927
2024-09-07 05:28:59 +00:00
nardoor
590b624ae3
feat: Add autocompletion hints (#1225)
## Feature

**Add auto completion hints**

This helps some shells to propose better completions.
For instance on `zsh`, no completion were proposed when doing `rustic
backup <...>[TAB]`

## Hints added
- `rustic backup <...>[TAB]`
- `rustic backup --as-path [TAB] <...>`
- `rustic backup --stdin-filename [TAB] <...>` This one is for comfort,
as the compl might not help (or might), but my opinion is that it's
better than nothing.
- `rustic diff <snapshot_id> <...>[TAB]`
- `rustic find --path <...>[TAB]`
- rustic --log-file <...>[TAB]`
2024-09-06 06:04:57 +00:00
aawsome
3f2b7a0b78
fix(build): allow to compile without tui feature (#1208)
closes #1206
2024-08-24 19:01:42 +00:00
nardoor
1c9969cc1f
feat(diff): show diff statistics (#1178)
closes rustic-rs/rustic#440

### Description

The proposed code contains:
- a DiffStatistics structure used to hold count of stats
- this structure offers a few helping functions that will look at a
given NodeType to increment the associated counter
- it has a Display implementation used to display the statistics in
STDOUT
- this structure is used in the `diff` function

### Exemple

```bash
rustic --log-level debug -r test-repo --password password diff 8e57051d:config ./config
[INFO] using no config file, none of these exist: /home/nardor/.config/rustic/rustic.toml, /etc/rustic/rustic.toml, ./rustic.toml
[INFO] repository local:test-repo: password is correct.
[INFO] using cache at /home/nardor/.cache/rustic/3797e1fe324e97ac068e303e672da3d34af09cd73888bcfd09538cd72692bf7d
[00:00:00] reading index...               ████████████████████████████████████████          2/2                               
[00:00:00] getting snapshot...            ████████████████████████████████████████          0                                
[INFO] getting snapshot...
[00:00:00] getting snapshot...            ████████████████████████████████████████          0                                 
-    "README.md"
M    "bar"
+    "new_dir"
+    "new_dir/new_file"
-    "services"
-    "services/b2.toml"
-    "services/rclone_ovh-hot-cold.toml"
-    "services/s3_aws.toml"
-    "services/s3_idrive.toml"
-    "services/sftp.toml"
-    "services/sftp_hetzner_sbox.toml"
-    "services/webdav_owncloud_nextcloud.toml"
Files:	1 new,	8 removed, 	1 changed
Dirs:	1 new,	1 removed
Others:	0 new,	0 removed
```

### Testing

I am not sure what tests I can add.
Please let me know if you think of any test about this.

Thanks in advance for any feedback.

---------

Co-authored-by: Alexander Weiss <alex@weissfam.de>
Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
2024-08-10 07:51:45 +00:00
aawsome
9bdb7fe02c
chore(deps): Update dependencies (#1196)
closes #1195
2024-08-10 04:13:38 +02:00
Yonas Yanfa
402aa7c5d3
docs: Fix typo in find.rs (#1187) 2024-07-31 13:59:22 +02:00
Daniel Oliveira
cb8c3760b5
fix(tui): reset terminal no matter what (#1175)
Currently if you run `rustic snapshots -i` without a repository
configured `rustic` will leave the terminal in raw mode.

This is a simple fix to make sure the terminal is properly reset in all
situations.

close #1166

Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
2024-07-10 04:12:05 +00:00
Alexander Weiss
599e61a900 fix clippy lints 2024-07-10 05:50:56 +02:00
aawsome
fc8e3c5539
feat(interactive): Add better progress bars (#1152) 2024-05-14 01:13:44 +02:00
aawsome
7665b84f74
fix: Respect delete-protection when running forget with ids (#1149)
closes #1148
2024-05-07 10:16:50 +02:00
aawsome
7ff4d2f6ff
fix clippy lints (#1150) 2024-05-07 09:57:25 +02:00
aawsome
dcd240a50a
feat(interactive): Prompt before exiting (#1146) 2024-05-01 00:20:37 +02:00
aawsome
6bf5069d0c
add find command (#1136)
Adds the new command `find`.
This commands allows to search for glob pattern using `--glob`/`--iglob`
or given paths using `--path` in a list of snapshots.
It displays all finds and is able accumulate snapshots with identical
search result. This allows to use this command as a history search:
`rustic find --path /my/path` shows (only) all changes of that path.
2024-04-30 11:54:43 +02:00
aawsome
a6bd54c7cb
more interactive improvements (#1145)
restore:
- propose path from snapshot as target
- handle empty target

write snapshots:
- clarify that you can enter (y/n)
2024-04-29 21:44:33 +02:00
aawsome
bd726839d9
interactive improvements: reset screen on panic; key bindings (#1144)
If a panic happens, the interactive screen is now reset so the terminal
can show the panic output.
Moreover, "to-delete" was renamed to "to-forget" and the key bindings
were changed to f / Ctrl-f.
2024-04-29 18:21:34 +02:00
aawsome
23a634d06a
feat(interactive): Allow to delete snapshots (#1143) 2024-04-28 23:16:22 +02:00
aawsome
a34000f912
feat(interactive): Add possibility to change snapshot description (#1137)
closes #1134
2024-04-26 01:06:50 +02:00
aawsome
595268217d
feat(logging): use RFC3339 time format in logfile (#1133)
Times in logfiles are now printed in RFC3339 format

closes #1076
2024-04-23 22:08:38 +02:00
aawsome
58ed4b3655
feat!: Allow specifying many options in config profile without array (#1130)
Breaking change:
`password-command` and `warmup-command` now must be given as array if
the commands use args.
2024-04-22 15:03:39 +02:00
aawsome
a1b31632ed
Interactive snapshots groups (#1129)
The interactive snapshots view now also groups snapshots.
2024-04-22 12:15:29 +02:00
aawsome
d8d4a93161
feat(interactive): ls: remember parent position (#1126) 2024-04-19 17:12:48 +02:00
aawsome
9980a36b7d
fix(config)!: multiple paths in config profile as array (#1124)
-- BREAKING CHANG --

Using multiple paths for a sources in the config file caused many
problems as the syntax was unclear and problems existed in edge cases.

This PR changes the definition of sources in config profile files:
- a single path path can be specified as before, i.e. using `source =
"/my/path"`.
- multiple paths must now be given in an array:
```
source = ["/my/path1", "/my/path2"]
```

Note that 
```
source = "/my/path1 /my/path2"
```
is now interpreted a a single path using the dir-tree "my","path1 "
(with space), "my", "path2".

closes #1122
closes #1094
2024-04-18 16:03:39 +02:00
aawsome
de93aa390d
feat: Add interactive restore (#1123)
Currently only available from the interactive ls mode, see #1117
2024-04-18 13:41:50 +02:00