Skip to content

Commit 05f6cd7

Browse files
authored
feat: add backup commands with comprehensive capabilities (#183)
2 parents 96d9ad3 + 606e491 commit 05f6cd7

File tree

9 files changed

+2492
-187
lines changed

9 files changed

+2492
-187
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## v1.1.0-alpha
5+
### BREAKING CHANGES
6+
This release implement new backup commands and features.
7+
Please read [wiki.md](docs/wiki.md) for more information how to use the new feature and how to migrate old backups to new format.
8+
9+
- Added support for `backup app_name --restore-last` restore last backup
10+
- Added support for `backup app_name --restore-version <version>` restore backup by version
11+
- Added support for `backup app_name --info` show backup info
12+
- Added support for `backup app_name --list-backups` list all backups
13+
- Added support for `backup app_name --cleanup` to clean up old backups manualy(This already automaticly works when the script used tough)
14+
- Added support for `backup app_name --migrate` to migrate old backups to new format
15+
#### Migration guide
16+
- Keep in mind that the migration process is irreversible and will cause data loss.
17+
- Run `backup app_name --migrate` to migrate old backups to new format.
18+
- If something goes wrong, migrate manually by moving the `~/Applications/backups` directory to `~/Applications/backups.old`
19+
than make sure to run migrate command again to migrate the new backups to the new format.
20+
421
## v1.0.1-alpha
522
## v1.0.0-alpha
623
### BREAKING CHANGES

docs/wiki.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,41 @@ python run.py auth --status
6868
python run.py auth --remove-token
6969
```
7070

71+
### Backup
72+
73+
#### Basic Operations
74+
75+
```bash
76+
# Create backup of current version
77+
backup <app_name>
78+
79+
# Restore latest backup version
80+
backup <app_name> --restore-last
81+
82+
# Restore specific version
83+
backup <app_name> --restore-version <version>
84+
```
85+
86+
#### Information & Management
87+
88+
```bash
89+
# List backups for specific app
90+
backup <app_name> --list-backups
91+
92+
# List all apps with backups
93+
backup --list-backups
94+
95+
# Show detailed backup info
96+
backup <app_name> --info
97+
98+
# Clean up old backups
99+
backup --cleanup # All apps
100+
backup <app_name> --cleanup # Specific app
101+
102+
# Migrate old backup format
103+
backup --migrate
104+
```
105+
71106
## 📋 Dependencies
72107

73108
### Core (working now)
@@ -285,11 +320,51 @@ tmp = "~/.config/my-unicorn/tmp"
285320
}
286321
```
287322

323+
#### Backup metadata.json implementation
324+
325+
##### 1. **Backup Storage Structure**
326+
327+
```
328+
~/Applications/backups/
329+
├── appflowy/
330+
│ ├── appflowy-1.2.3.AppImage
331+
│ ├── appflowy-1.3.0.AppImage
332+
│ └── metadata.json
333+
└── obsidian/
334+
├── obsidian-1.9.1.AppImage
335+
├── obsidian-1.9.10.AppImage
336+
└── metadata.json
337+
```
338+
339+
##### 2. **Metadata Structure (metadata.json)**
340+
341+
> [!NOTE]
342+
> file path: `~/Applications/backups/obsidian/metadata.json`
343+
344+
```json
345+
{
346+
"versions": {
347+
"1.9.1": {
348+
"created": "2025-08-19T14:36:49.868125",
349+
"filename": "obsidian-1.9.1.AppImage",
350+
"sha256": "24471d25ed4d7d797a20a8ddf7b81ec43ae337f9ce495514dfdbb893307472b7",
351+
"size": 125682911
352+
},
353+
"1.9.10": {
354+
"created": "2025-08-19T14:01:21.787195",
355+
"filename": "obsidian-1.9.10.AppImage",
356+
"sha256": "24471d25ed4d7d797a20a8ddf7b81ec43ae337f9ce495514dfdbb893307472b7",
357+
"size": 125682911
358+
}
359+
}
360+
}
361+
```
362+
288363
## Remove the package:
289364

290365
> [!TIP]
291366
> This would remove the package if you installed globally.
292367
293368
```bash
294369
pip uninstall my-unicorn
295-
```
370+
```

0 commit comments

Comments
 (0)