dotctl 1.0.9__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dotctl-1.0.9/src/dotctl.egg-info → dotctl-1.1.1}/PKG-INFO +108 -22
- {dotctl-1.0.9 → dotctl-1.1.1}/README.md +103 -18
- {dotctl-1.0.9 → dotctl-1.1.1}/pyproject.toml +3 -3
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/__init__.py +1 -1
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/activator.py +9 -2
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/creator.py +16 -24
- dotctl-1.1.1/src/dotctl/actions/differ.py +128 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/exporter.py +16 -1
- dotctl-1.1.1/src/dotctl/actions/importer.py +184 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/remover.py +2 -1
- dotctl-1.1.1/src/dotctl/actions/saver.py +210 -0
- dotctl-1.1.1/src/dotctl/actions/status.py +440 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/arg_manager.py +42 -1
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/exception.py +3 -1
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/handlers/config_handler.py +75 -5
- dotctl-1.1.1/src/dotctl/handlers/data_handler.py +249 -0
- dotctl-1.1.1/src/dotctl/handlers/diff_handler.py +321 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/handlers/git_handler.py +3 -9
- dotctl-1.1.1/src/dotctl/handlers/status_handler.py +238 -0
- dotctl-1.1.1/src/dotctl/handlers/sudo_handler.py +283 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/main.py +37 -2
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/templates/kde.yaml +3 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/utils.py +1 -1
- {dotctl-1.0.9 → dotctl-1.1.1/src/dotctl.egg-info}/PKG-INFO +108 -22
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl.egg-info/SOURCES.txt +5 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl.egg-info/requires.txt +1 -0
- dotctl-1.0.9/src/dotctl/actions/importer.py +0 -133
- dotctl-1.0.9/src/dotctl/actions/saver.py +0 -146
- dotctl-1.0.9/src/dotctl/handlers/data_handler.py +0 -198
- {dotctl-1.0.9 → dotctl-1.1.1}/LICENSE +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/setup.cfg +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/__init__.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/initializer.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/lister.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/puller.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/switcher.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/actions/wiper.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/handlers/__init__.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/handlers/hooks_handler.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/hooks/post_apply.sh +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/hooks/pre_apply.sh +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/paths.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/templates/__init__.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/templates/dev.yaml +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/templates/other.yaml +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl/validators.py +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl.egg-info/dependency_links.txt +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl.egg-info/entry_points.txt +0 -0
- {dotctl-1.0.9 → dotctl-1.1.1}/src/dotctl.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dotctl
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: A powerful CLI tool to profile your OS by saving, applying, exporting, and importing system configurations as named profiles. Designed to manage dot files and service configurations in a centralized Git repository (local or remote), dotctl enables seamless system replication across machines. Supports pre/post hook scripts, making it ideal for setting up servers or desktops with consistent environments.
|
|
5
5
|
Author-email: Pankaj Jackson <pankajackson@live.co.uk>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -8,12 +8,12 @@ Project-URL: Homepage, https://github.com/pankajackson/dotctl
|
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/pankajackson/dotctl/issues
|
|
9
9
|
Project-URL: Source, https://github.com/pankajackson/dotctl
|
|
10
10
|
Keywords: dotfiles,config,settings,backup,dotfile-manager
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier:
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
15
|
Classifier: Intended Audience :: End Users/Desktop
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
17
|
Classifier: Operating System :: POSIX :: Linux
|
|
18
18
|
Classifier: Topic :: System :: Archiving :: Backup
|
|
19
19
|
Classifier: Topic :: Utilities
|
|
@@ -22,6 +22,7 @@ Description-Content-Type: text/markdown
|
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: PyYAML
|
|
24
24
|
Requires-Dist: gitpython
|
|
25
|
+
Requires-Dist: rich
|
|
25
26
|
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
# DotCtl
|
|
@@ -58,9 +59,12 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
|
|
|
58
59
|
- [❌ `remove` / `rm` / `delete` / `del`](#-remove--rm--delete--del)
|
|
59
60
|
- [🧪 `apply`](#-apply)
|
|
60
61
|
- [🔄 `pull`](#-pull)
|
|
62
|
+
- [🔍 `status`](#-status)
|
|
63
|
+
- [🔎 `diff`](#-diff)
|
|
61
64
|
- [📤 `export`](#-export)
|
|
62
65
|
- [📥 `import`](#-import)
|
|
63
66
|
- [🔥 `wipe`](#-wipe)
|
|
67
|
+
- [⚠️ Limitations \& Notes](#️-limitations--notes)
|
|
64
68
|
- [🧑💻 Development \& Publishing](#-development--publishing)
|
|
65
69
|
- [Setup Development Environment](#setup-development-environment)
|
|
66
70
|
- [Test the new code](#test-the-new-code)
|
|
@@ -84,7 +88,7 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
|
|
|
84
88
|
|
|
85
89
|
## 📁 Profile Config Structure (`dotctl.yaml`)
|
|
86
90
|
|
|
87
|
-
The `dotctl.
|
|
91
|
+
The `dotctl.yaml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
|
|
88
92
|
|
|
89
93
|
### 🧠 Concept Overview
|
|
90
94
|
|
|
@@ -118,6 +122,15 @@ To simplify path definitions, these keys can be used in `location`:
|
|
|
118
122
|
|
|
119
123
|
Use them to make profiles portable across systems.
|
|
120
124
|
|
|
125
|
+
Each `save` or `export` section may set `required_sudo: true` when its configured
|
|
126
|
+
location should be accessed through sudo. If `sudo` is omitted or `false`,
|
|
127
|
+
dotctl first uses normal access and asks for sudo only if the path is restricted.
|
|
128
|
+
At the prompt, you can provide a password or skip the current path/all paths.
|
|
129
|
+
Sections may also set `ignore_patterns` to exclude matching paths from save,
|
|
130
|
+
apply, export, import, status, and diff operations. Patterns use Python's
|
|
131
|
+
`fnmatch` syntax and are matched against paths relative to the section's
|
|
132
|
+
`location`; matching directories exclude their contents too.
|
|
133
|
+
|
|
121
134
|
---
|
|
122
135
|
|
|
123
136
|
### ✅ Example: Minimal Config
|
|
@@ -128,6 +141,10 @@ save:
|
|
|
128
141
|
location: $HOME
|
|
129
142
|
entries:
|
|
130
143
|
- test.txt
|
|
144
|
+
ignore_patterns:
|
|
145
|
+
- "*.pdf"
|
|
146
|
+
- "somedir/*.jpg"
|
|
147
|
+
- "logs/apache_web_*.log"
|
|
131
148
|
|
|
132
149
|
export:
|
|
133
150
|
share_folder:
|
|
@@ -236,6 +253,7 @@ export:
|
|
|
236
253
|
|
|
237
254
|
sddm:
|
|
238
255
|
location: $SYS_SHARE_DIR/sddm
|
|
256
|
+
required_sudo: true
|
|
239
257
|
entries:
|
|
240
258
|
- themes
|
|
241
259
|
```
|
|
@@ -260,7 +278,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
260
278
|
|
|
261
279
|
```js
|
|
262
280
|
┌──────────────┐
|
|
263
|
-
│
|
|
281
|
+
│ dotctl.yaml │
|
|
264
282
|
└──────┬───────┘
|
|
265
283
|
│
|
|
266
284
|
┌─────────▼──────────┐
|
|
@@ -312,12 +330,16 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
312
330
|
|
|
313
331
|
## 📊 Profile Block Table
|
|
314
332
|
|
|
315
|
-
| Section | Field
|
|
316
|
-
| -------- |
|
|
317
|
-
| `save` | `location`
|
|
318
|
-
| | `entries`
|
|
319
|
-
|
|
|
320
|
-
| | `
|
|
333
|
+
| Section | Field | Description |
|
|
334
|
+
| -------- | ----------------- | ----------------------------------------------------------------- |
|
|
335
|
+
| `save` | `location` | Base path of tracked files (can use a key like `$CONFIG_DIR`) |
|
|
336
|
+
| | `entries` | Files/folders to track under that location |
|
|
337
|
+
| | `required_sudo` | Whether restricted paths in this section require sudo |
|
|
338
|
+
| | `ignore_patterns` | fnmatch patterns excluded from every operation on the section |
|
|
339
|
+
| `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
|
|
340
|
+
| | `entries` | Assets or binaries to package in `.dtsv` |
|
|
341
|
+
| | `required_sudo` | Whether restricted paths in this section require sudo |
|
|
342
|
+
| | `ignore_patterns` | fnmatch patterns excluded from every operation on the section |
|
|
321
343
|
|
|
322
344
|
---
|
|
323
345
|
|
|
@@ -325,7 +347,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
325
347
|
|
|
326
348
|
| Action | Command | Description |
|
|
327
349
|
| --------------- | ---------------------- | ----------------------------------------------------------- |
|
|
328
|
-
| Save configs | `dotctl save` |
|
|
350
|
+
| Save configs | `dotctl save` | Saves configured files to the active profile and syncs Git |
|
|
329
351
|
| Export assets | `dotctl export` | Package large, non-Git assets into `.dtsv` file |
|
|
330
352
|
| Transfer assets | `scp profile.dtsv ...` | Manually copy to another machine |
|
|
331
353
|
| Import assets | `dotctl import` | Unpack `.dtsv` on another system |
|
|
@@ -339,6 +361,9 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
339
361
|
pip install dotctl
|
|
340
362
|
```
|
|
341
363
|
|
|
364
|
+
Profile operations require the `git` command. Commands that copy files also require
|
|
365
|
+
`rsync`. Restricted paths prompt for a sudo password when needed.
|
|
366
|
+
|
|
342
367
|
---
|
|
343
368
|
|
|
344
369
|
## 📘 Usage
|
|
@@ -380,7 +405,7 @@ dotctl init -c ./my_custom_config.yaml
|
|
|
380
405
|
|
|
381
406
|
### 💾 `save`
|
|
382
407
|
|
|
383
|
-
Save current system state to
|
|
408
|
+
Save current system state to a profile.
|
|
384
409
|
|
|
385
410
|
```sh
|
|
386
411
|
dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
|
|
@@ -391,10 +416,20 @@ dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
|
|
|
391
416
|
```sh
|
|
392
417
|
dotctl save
|
|
393
418
|
dotctl save my_web_server --skip-sudo
|
|
394
|
-
dotctl save my_web_server -p mYsecretp@ssw0rd
|
|
395
419
|
dotctl save --prune
|
|
420
|
+
dotctl save a_new_profile
|
|
396
421
|
```
|
|
397
422
|
|
|
423
|
+
Without a profile name, `save` targets the active profile. If the named profile
|
|
424
|
+
already exists, dotctl saves to it and then returns to the previously active
|
|
425
|
+
profile. If it does not exist, dotctl creates it from the active profile, saves
|
|
426
|
+
the current system state there, and returns to the previous profile. When a
|
|
427
|
+
remote is configured, dotctl pushes a target branch that is not on the remote,
|
|
428
|
+
even if the save produced no file changes.
|
|
429
|
+
|
|
430
|
+
Prefer the interactive sudo prompt over passing a password with `-p`, since command-line
|
|
431
|
+
arguments can be recorded in shell history or visible to other local processes.
|
|
432
|
+
|
|
398
433
|
> Tip: Use --prune to clean files that were saved before but are no longer listed in the config.
|
|
399
434
|
|
|
400
435
|
**Options:**
|
|
@@ -402,7 +437,7 @@ dotctl save --prune
|
|
|
402
437
|
- `--skip-sudo` – Ignore restricted resources.
|
|
403
438
|
- `-p, --password` – Password for restricted resources.
|
|
404
439
|
- `--prune` – Remove stale files from the dot repo that are no longer listed in the current `dotctl.yaml` config.
|
|
405
|
-
- `profile` – Target profile
|
|
440
|
+
- `profile` – Target profile. A new name starts as a copy of the active profile; omitted means the active profile.
|
|
406
441
|
|
|
407
442
|
---
|
|
408
443
|
|
|
@@ -452,7 +487,8 @@ dotctl sw MyProfile --fetch
|
|
|
452
487
|
|
|
453
488
|
### 🆕 `create` / `new`
|
|
454
489
|
|
|
455
|
-
Create a new, empty profile.
|
|
490
|
+
Create a new, empty profile and initialize its config and hooks. The new profile
|
|
491
|
+
becomes active.
|
|
456
492
|
|
|
457
493
|
```sh
|
|
458
494
|
dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
|
|
@@ -461,14 +497,14 @@ dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
|
|
|
461
497
|
**Examples:**
|
|
462
498
|
|
|
463
499
|
```sh
|
|
464
|
-
# Create a
|
|
500
|
+
# Create a fresh profile using the detected environment or default config.
|
|
465
501
|
dotctl create myserver
|
|
466
502
|
|
|
467
|
-
# Create a
|
|
468
|
-
dotctl create -e kde
|
|
503
|
+
# Create a fresh profile from a specific environment.
|
|
504
|
+
dotctl create -e kde kde_desktop
|
|
469
505
|
|
|
470
|
-
# Create a
|
|
471
|
-
dotctl create -c ./my_custom_config.yaml
|
|
506
|
+
# Create a fresh profile from a custom config.
|
|
507
|
+
dotctl create -c ./my_custom_config.yaml my_custom_profile
|
|
472
508
|
```
|
|
473
509
|
|
|
474
510
|
**Options:**
|
|
@@ -547,6 +583,47 @@ dotctl pull
|
|
|
547
583
|
|
|
548
584
|
---
|
|
549
585
|
|
|
586
|
+
### 🔍 `status`
|
|
587
|
+
|
|
588
|
+
Inspect the current profile health and detect configuration drift between the repository and local system.
|
|
589
|
+
|
|
590
|
+
```sh
|
|
591
|
+
dotctl status [--json] [--short] [--long]
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
**Examples:**
|
|
595
|
+
|
|
596
|
+
```sh
|
|
597
|
+
dotctl status
|
|
598
|
+
dotctl status --short
|
|
599
|
+
dotctl status --json
|
|
600
|
+
dotctl status --long
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
`--long` lists the affected files beneath each changed entry. JSON status
|
|
604
|
+
includes a `files` array on each entry; for directory entries its paths are
|
|
605
|
+
relative to that configured entry.
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
### 🔎 `diff`
|
|
610
|
+
|
|
611
|
+
Compare tracked files between the repository and local system.
|
|
612
|
+
|
|
613
|
+
```sh
|
|
614
|
+
dotctl diff [--color] [--side-by-side]
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
**Examples:**
|
|
618
|
+
|
|
619
|
+
```sh
|
|
620
|
+
dotctl diff
|
|
621
|
+
dotctl diff --color
|
|
622
|
+
dotctl diff --side-by-side
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
550
627
|
### 📤 `export`
|
|
551
628
|
|
|
552
629
|
Export a profile to `.dtsv`.
|
|
@@ -611,6 +688,15 @@ dotctl wipe -y
|
|
|
611
688
|
|
|
612
689
|
---
|
|
613
690
|
|
|
691
|
+
## ⚠️ Limitations & Notes
|
|
692
|
+
|
|
693
|
+
- Configured filesystem operations (`save`, `apply`, `export`, `import`, `status`, and `diff`) support sudo access for restricted paths. Set `required_sudo: true` on the relevant config section when sudo access is expected; otherwise dotctl tries normal access and requests sudo if needed.
|
|
694
|
+
- `status` and `diff` can report paths as inaccessible when access is denied or the user skips the sudo request.
|
|
695
|
+
- Ensure tracked files/directories have proper read permissions before adding them to `dotctl.yaml`.
|
|
696
|
+
- Missing or inaccessible files may appear as drift during `status` or `diff` operations.
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
614
700
|
## 🧑💻 Development & Publishing
|
|
615
701
|
|
|
616
702
|
### Setup Development Environment
|
|
@@ -32,9 +32,12 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
|
|
|
32
32
|
- [❌ `remove` / `rm` / `delete` / `del`](#-remove--rm--delete--del)
|
|
33
33
|
- [🧪 `apply`](#-apply)
|
|
34
34
|
- [🔄 `pull`](#-pull)
|
|
35
|
+
- [🔍 `status`](#-status)
|
|
36
|
+
- [🔎 `diff`](#-diff)
|
|
35
37
|
- [📤 `export`](#-export)
|
|
36
38
|
- [📥 `import`](#-import)
|
|
37
39
|
- [🔥 `wipe`](#-wipe)
|
|
40
|
+
- [⚠️ Limitations \& Notes](#️-limitations--notes)
|
|
38
41
|
- [🧑💻 Development \& Publishing](#-development--publishing)
|
|
39
42
|
- [Setup Development Environment](#setup-development-environment)
|
|
40
43
|
- [Test the new code](#test-the-new-code)
|
|
@@ -58,7 +61,7 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
|
|
|
58
61
|
|
|
59
62
|
## 📁 Profile Config Structure (`dotctl.yaml`)
|
|
60
63
|
|
|
61
|
-
The `dotctl.
|
|
64
|
+
The `dotctl.yaml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
|
|
62
65
|
|
|
63
66
|
### 🧠 Concept Overview
|
|
64
67
|
|
|
@@ -92,6 +95,15 @@ To simplify path definitions, these keys can be used in `location`:
|
|
|
92
95
|
|
|
93
96
|
Use them to make profiles portable across systems.
|
|
94
97
|
|
|
98
|
+
Each `save` or `export` section may set `required_sudo: true` when its configured
|
|
99
|
+
location should be accessed through sudo. If `sudo` is omitted or `false`,
|
|
100
|
+
dotctl first uses normal access and asks for sudo only if the path is restricted.
|
|
101
|
+
At the prompt, you can provide a password or skip the current path/all paths.
|
|
102
|
+
Sections may also set `ignore_patterns` to exclude matching paths from save,
|
|
103
|
+
apply, export, import, status, and diff operations. Patterns use Python's
|
|
104
|
+
`fnmatch` syntax and are matched against paths relative to the section's
|
|
105
|
+
`location`; matching directories exclude their contents too.
|
|
106
|
+
|
|
95
107
|
---
|
|
96
108
|
|
|
97
109
|
### ✅ Example: Minimal Config
|
|
@@ -102,6 +114,10 @@ save:
|
|
|
102
114
|
location: $HOME
|
|
103
115
|
entries:
|
|
104
116
|
- test.txt
|
|
117
|
+
ignore_patterns:
|
|
118
|
+
- "*.pdf"
|
|
119
|
+
- "somedir/*.jpg"
|
|
120
|
+
- "logs/apache_web_*.log"
|
|
105
121
|
|
|
106
122
|
export:
|
|
107
123
|
share_folder:
|
|
@@ -210,6 +226,7 @@ export:
|
|
|
210
226
|
|
|
211
227
|
sddm:
|
|
212
228
|
location: $SYS_SHARE_DIR/sddm
|
|
229
|
+
required_sudo: true
|
|
213
230
|
entries:
|
|
214
231
|
- themes
|
|
215
232
|
```
|
|
@@ -234,7 +251,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
234
251
|
|
|
235
252
|
```js
|
|
236
253
|
┌──────────────┐
|
|
237
|
-
│
|
|
254
|
+
│ dotctl.yaml │
|
|
238
255
|
└──────┬───────┘
|
|
239
256
|
│
|
|
240
257
|
┌─────────▼──────────┐
|
|
@@ -286,12 +303,16 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
286
303
|
|
|
287
304
|
## 📊 Profile Block Table
|
|
288
305
|
|
|
289
|
-
| Section | Field
|
|
290
|
-
| -------- |
|
|
291
|
-
| `save` | `location`
|
|
292
|
-
| | `entries`
|
|
293
|
-
|
|
|
294
|
-
| | `
|
|
306
|
+
| Section | Field | Description |
|
|
307
|
+
| -------- | ----------------- | ----------------------------------------------------------------- |
|
|
308
|
+
| `save` | `location` | Base path of tracked files (can use a key like `$CONFIG_DIR`) |
|
|
309
|
+
| | `entries` | Files/folders to track under that location |
|
|
310
|
+
| | `required_sudo` | Whether restricted paths in this section require sudo |
|
|
311
|
+
| | `ignore_patterns` | fnmatch patterns excluded from every operation on the section |
|
|
312
|
+
| `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
|
|
313
|
+
| | `entries` | Assets or binaries to package in `.dtsv` |
|
|
314
|
+
| | `required_sudo` | Whether restricted paths in this section require sudo |
|
|
315
|
+
| | `ignore_patterns` | fnmatch patterns excluded from every operation on the section |
|
|
295
316
|
|
|
296
317
|
---
|
|
297
318
|
|
|
@@ -299,7 +320,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
299
320
|
|
|
300
321
|
| Action | Command | Description |
|
|
301
322
|
| --------------- | ---------------------- | ----------------------------------------------------------- |
|
|
302
|
-
| Save configs | `dotctl save` |
|
|
323
|
+
| Save configs | `dotctl save` | Saves configured files to the active profile and syncs Git |
|
|
303
324
|
| Export assets | `dotctl export` | Package large, non-Git assets into `.dtsv` file |
|
|
304
325
|
| Transfer assets | `scp profile.dtsv ...` | Manually copy to another machine |
|
|
305
326
|
| Import assets | `dotctl import` | Unpack `.dtsv` on another system |
|
|
@@ -313,6 +334,9 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
|
|
|
313
334
|
pip install dotctl
|
|
314
335
|
```
|
|
315
336
|
|
|
337
|
+
Profile operations require the `git` command. Commands that copy files also require
|
|
338
|
+
`rsync`. Restricted paths prompt for a sudo password when needed.
|
|
339
|
+
|
|
316
340
|
---
|
|
317
341
|
|
|
318
342
|
## 📘 Usage
|
|
@@ -354,7 +378,7 @@ dotctl init -c ./my_custom_config.yaml
|
|
|
354
378
|
|
|
355
379
|
### 💾 `save`
|
|
356
380
|
|
|
357
|
-
Save current system state to
|
|
381
|
+
Save current system state to a profile.
|
|
358
382
|
|
|
359
383
|
```sh
|
|
360
384
|
dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
|
|
@@ -365,10 +389,20 @@ dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
|
|
|
365
389
|
```sh
|
|
366
390
|
dotctl save
|
|
367
391
|
dotctl save my_web_server --skip-sudo
|
|
368
|
-
dotctl save my_web_server -p mYsecretp@ssw0rd
|
|
369
392
|
dotctl save --prune
|
|
393
|
+
dotctl save a_new_profile
|
|
370
394
|
```
|
|
371
395
|
|
|
396
|
+
Without a profile name, `save` targets the active profile. If the named profile
|
|
397
|
+
already exists, dotctl saves to it and then returns to the previously active
|
|
398
|
+
profile. If it does not exist, dotctl creates it from the active profile, saves
|
|
399
|
+
the current system state there, and returns to the previous profile. When a
|
|
400
|
+
remote is configured, dotctl pushes a target branch that is not on the remote,
|
|
401
|
+
even if the save produced no file changes.
|
|
402
|
+
|
|
403
|
+
Prefer the interactive sudo prompt over passing a password with `-p`, since command-line
|
|
404
|
+
arguments can be recorded in shell history or visible to other local processes.
|
|
405
|
+
|
|
372
406
|
> Tip: Use --prune to clean files that were saved before but are no longer listed in the config.
|
|
373
407
|
|
|
374
408
|
**Options:**
|
|
@@ -376,7 +410,7 @@ dotctl save --prune
|
|
|
376
410
|
- `--skip-sudo` – Ignore restricted resources.
|
|
377
411
|
- `-p, --password` – Password for restricted resources.
|
|
378
412
|
- `--prune` – Remove stale files from the dot repo that are no longer listed in the current `dotctl.yaml` config.
|
|
379
|
-
- `profile` – Target profile
|
|
413
|
+
- `profile` – Target profile. A new name starts as a copy of the active profile; omitted means the active profile.
|
|
380
414
|
|
|
381
415
|
---
|
|
382
416
|
|
|
@@ -426,7 +460,8 @@ dotctl sw MyProfile --fetch
|
|
|
426
460
|
|
|
427
461
|
### 🆕 `create` / `new`
|
|
428
462
|
|
|
429
|
-
Create a new, empty profile.
|
|
463
|
+
Create a new, empty profile and initialize its config and hooks. The new profile
|
|
464
|
+
becomes active.
|
|
430
465
|
|
|
431
466
|
```sh
|
|
432
467
|
dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
|
|
@@ -435,14 +470,14 @@ dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
|
|
|
435
470
|
**Examples:**
|
|
436
471
|
|
|
437
472
|
```sh
|
|
438
|
-
# Create a
|
|
473
|
+
# Create a fresh profile using the detected environment or default config.
|
|
439
474
|
dotctl create myserver
|
|
440
475
|
|
|
441
|
-
# Create a
|
|
442
|
-
dotctl create -e kde
|
|
476
|
+
# Create a fresh profile from a specific environment.
|
|
477
|
+
dotctl create -e kde kde_desktop
|
|
443
478
|
|
|
444
|
-
# Create a
|
|
445
|
-
dotctl create -c ./my_custom_config.yaml
|
|
479
|
+
# Create a fresh profile from a custom config.
|
|
480
|
+
dotctl create -c ./my_custom_config.yaml my_custom_profile
|
|
446
481
|
```
|
|
447
482
|
|
|
448
483
|
**Options:**
|
|
@@ -521,6 +556,47 @@ dotctl pull
|
|
|
521
556
|
|
|
522
557
|
---
|
|
523
558
|
|
|
559
|
+
### 🔍 `status`
|
|
560
|
+
|
|
561
|
+
Inspect the current profile health and detect configuration drift between the repository and local system.
|
|
562
|
+
|
|
563
|
+
```sh
|
|
564
|
+
dotctl status [--json] [--short] [--long]
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
**Examples:**
|
|
568
|
+
|
|
569
|
+
```sh
|
|
570
|
+
dotctl status
|
|
571
|
+
dotctl status --short
|
|
572
|
+
dotctl status --json
|
|
573
|
+
dotctl status --long
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
`--long` lists the affected files beneath each changed entry. JSON status
|
|
577
|
+
includes a `files` array on each entry; for directory entries its paths are
|
|
578
|
+
relative to that configured entry.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
### 🔎 `diff`
|
|
583
|
+
|
|
584
|
+
Compare tracked files between the repository and local system.
|
|
585
|
+
|
|
586
|
+
```sh
|
|
587
|
+
dotctl diff [--color] [--side-by-side]
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
**Examples:**
|
|
591
|
+
|
|
592
|
+
```sh
|
|
593
|
+
dotctl diff
|
|
594
|
+
dotctl diff --color
|
|
595
|
+
dotctl diff --side-by-side
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
---
|
|
599
|
+
|
|
524
600
|
### 📤 `export`
|
|
525
601
|
|
|
526
602
|
Export a profile to `.dtsv`.
|
|
@@ -585,6 +661,15 @@ dotctl wipe -y
|
|
|
585
661
|
|
|
586
662
|
---
|
|
587
663
|
|
|
664
|
+
## ⚠️ Limitations & Notes
|
|
665
|
+
|
|
666
|
+
- Configured filesystem operations (`save`, `apply`, `export`, `import`, `status`, and `diff`) support sudo access for restricted paths. Set `required_sudo: true` on the relevant config section when sudo access is expected; otherwise dotctl tries normal access and requests sudo if needed.
|
|
667
|
+
- `status` and `diff` can report paths as inaccessible when access is denied or the user skips the sudo request.
|
|
668
|
+
- Ensure tracked files/directories have proper read permissions before adding them to `dotctl.yaml`.
|
|
669
|
+
- Missing or inaccessible files may appear as drift during `status` or `diff` operations.
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
588
673
|
## 🧑💻 Development & Publishing
|
|
589
674
|
|
|
590
675
|
### Setup Development Environment
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dotctl"
|
|
7
|
-
version = "v1.
|
|
7
|
+
version = "v1.1.1"
|
|
8
8
|
description = "A powerful CLI tool to profile your OS by saving, applying, exporting, and importing system configurations as named profiles. Designed to manage dot files and service configurations in a centralized Git repository (local or remote), dotctl enables seamless system replication across machines. Supports pre/post hook scripts, making it ideal for setting up servers or desktops with consistent environments."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
11
11
|
license-files = [ "LICENSE",]
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
|
-
dependencies = [ "PyYAML", "gitpython",]
|
|
13
|
+
dependencies = [ "PyYAML", "gitpython", "rich",]
|
|
14
14
|
keywords = [ "dotfiles", "config", "settings", "backup", "dotfile-manager",]
|
|
15
|
-
classifiers = [ "Programming Language :: Python :: 3.
|
|
15
|
+
classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Development Status :: 5 - Production/Stable", "Intended Audience :: End Users/Desktop", "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Topic :: System :: Archiving :: Backup", "Topic :: Utilities",]
|
|
16
16
|
[[project.authors]]
|
|
17
17
|
name = "Pankaj Jackson"
|
|
18
18
|
email = "pankajackson@live.co.uk"
|
|
@@ -4,6 +4,7 @@ from dotctl.utils import log
|
|
|
4
4
|
from dotctl.handlers.data_handler import copy
|
|
5
5
|
from dotctl.paths import app_profile_directory, app_config_file
|
|
6
6
|
from dotctl.handlers.config_handler import conf_reader
|
|
7
|
+
from dotctl.handlers.config_handler import is_ignored, patterns_for_entry
|
|
7
8
|
from dotctl.handlers.hooks_handler import run_hooks
|
|
8
9
|
from dotctl.handlers.git_handler import (
|
|
9
10
|
get_repo,
|
|
@@ -72,13 +73,19 @@ def apply(props: ActivatorProps) -> None:
|
|
|
72
73
|
for name, section in config.save.items():
|
|
73
74
|
source_base_dir = profile_dir / name
|
|
74
75
|
dest_base_dir = Path(section.location)
|
|
75
|
-
dest_base_dir.mkdir(exist_ok=True)
|
|
76
76
|
log(f'Applying "{name}"...')
|
|
77
77
|
for entry in section.entries:
|
|
78
|
+
if is_ignored(entry, section.ignore_patterns):
|
|
79
|
+
continue
|
|
78
80
|
source = source_base_dir / entry
|
|
79
81
|
dest = dest_base_dir / entry
|
|
80
82
|
result = copy(
|
|
81
|
-
source,
|
|
83
|
+
source,
|
|
84
|
+
dest,
|
|
85
|
+
skip_sudo=props.skip_sudo,
|
|
86
|
+
sudo_pass=props.password,
|
|
87
|
+
required_sudo=section.required_sudo,
|
|
88
|
+
ignore_patterns=patterns_for_entry(entry, section.ignore_patterns),
|
|
82
89
|
)
|
|
83
90
|
|
|
84
91
|
# Updated props
|
|
@@ -15,7 +15,6 @@ from dotctl.handlers.git_handler import (
|
|
|
15
15
|
get_repo,
|
|
16
16
|
get_repo_branches,
|
|
17
17
|
git_fetch,
|
|
18
|
-
create_branch,
|
|
19
18
|
create_empty_branch,
|
|
20
19
|
is_remote_repo,
|
|
21
20
|
is_repo_changed,
|
|
@@ -55,17 +54,13 @@ def create(props: CreatorProps):
|
|
|
55
54
|
if props.profile in all_profiles:
|
|
56
55
|
log(f"❌ Profile '{props.profile}' already exists.")
|
|
57
56
|
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
hooks_initializer()
|
|
67
|
-
else:
|
|
68
|
-
create_branch(repo, props.profile)
|
|
57
|
+
|
|
58
|
+
create_empty_branch(repo, props.profile)
|
|
59
|
+
|
|
60
|
+
if isinstance(props.config, str):
|
|
61
|
+
props.config = Path(props.config)
|
|
62
|
+
conf_initializer(env=props.env, custom_config=props.config)
|
|
63
|
+
hooks_initializer()
|
|
69
64
|
|
|
70
65
|
add_changes(repo=repo)
|
|
71
66
|
if is_repo_changed(repo=repo):
|
|
@@ -73,17 +68,14 @@ def create(props: CreatorProps):
|
|
|
73
68
|
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
74
69
|
full_message = f"{hostname} | Profile Initialized | {timestamp}"
|
|
75
70
|
commit_changes(repo=repo, message=full_message)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
push_new_branch(repo=repo)
|
|
86
|
-
else:
|
|
87
|
-
push_existing_branch(repo=repo)
|
|
71
|
+
|
|
72
|
+
is_remote, _ = is_remote_repo(repo=repo)
|
|
73
|
+
if is_remote:
|
|
74
|
+
git_fetch(repo=repo)
|
|
75
|
+
_, remote_profiles, _, _ = get_repo_branches(repo)
|
|
76
|
+
if props.profile not in remote_profiles:
|
|
77
|
+
push_new_branch(repo=repo)
|
|
78
|
+
else:
|
|
79
|
+
push_existing_branch(repo=repo)
|
|
88
80
|
|
|
89
81
|
log(f"✅ Profile '{props.profile}' created and activated successfully.")
|