From 23b8fe5529b77d7382ceeecd3796320dfa729bfa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:23:10 +0000 Subject: [PATCH 1/4] Initial plan From da03e2329edd352f7476dca4a2e7543183e985ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:25:21 +0000 Subject: [PATCH 2/4] fix: update README to reflect new param names after changes in #18 and #19 Agent-Logs-Url: https://github.com/FertigLab/ontrack/sessions/190d3356-4e2a-4991-89f2-d08e20ba9b76 Co-authored-by: dimalvovs <1246862+dimalvovs@users.noreply.github.com> --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8e02d68..fe49f4f 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,9 @@ Create a YAML config file (see [`config.yaml`](config.yaml) for a template): paths: - /path/to/data -# Unix group whose members' subdirectories should be reported (optional) -group: your_group_name +# Unix groups whose members' subdirectories should be reported (optional) +groups: + - your_group_name # Shell-style glob patterns for files/directories to exclude (optional) ignore: @@ -37,7 +38,7 @@ ignore: | Key | Description | |---|---| | `paths` | List of top-level paths to scan (required) | -| `group` | Unix group name; enables group mode (optional, overridden by `--group`) | +| `groups` | List of Unix group names; enables group mode (optional, overridden by `--groups`) | | `ignore` | Glob patterns matched against base names to exclude from all scans | ## Usage @@ -49,7 +50,7 @@ python3 ontrack.py --config config.yaml [OPTIONS] | Option | Description | |---|---| | `--config FILE` | Path to the YAML config file (default: `config.yaml`) | -| `--group GROUP` | Unix group name; overrides the `group` key in the config file | +| `--groups GROUP [GROUP ...]` | One or more Unix group names; overrides the `groups` key in the config file | | `--light` | Skip file-count and size scanning; only report directory and owner | | `--progress` | Show progress bars while scanning | | `--output FILE` | Write the report as YAML to `FILE` instead of printing to stdout | @@ -62,10 +63,10 @@ python3 ontrack.py --config config.yaml [OPTIONS] python3 ontrack.py --config config.yaml ``` -**Group mode** — for each configured directory, finds and reports subdirectories owned by members of the specified Unix group. Descends until a directory containing at least one file is found: +**Group mode** — for each configured directory, finds and reports subdirectories owned by members of the specified Unix groups. Descends until a directory containing at least one file is found: ```bash -python3 ontrack.py --config config.yaml --group researchers +python3 ontrack.py --config config.yaml --groups researchers ``` ## Example Output @@ -73,13 +74,13 @@ python3 ontrack.py --config config.yaml --group researchers ``` Directory : /data/projects/alice Username : alice -Group : researchers +Groups : researchers Files : 1042 Total size: 3.57 GB Directory : /data/projects/bob Username : bob -Group : researchers +Groups : researchers Files : 204 Total size: 512.00 MB ``` From e1ad1339f7740c73663257c63570a69df1c4721c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:41:14 +0000 Subject: [PATCH 3/4] docs: revert example output group label to singular 'Group' Agent-Logs-Url: https://github.com/FertigLab/ontrack/sessions/095a5e31-d89a-41e0-ae0b-9de5291cc6c7 Co-authored-by: dimalvovs <1246862+dimalvovs@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe49f4f..42dad74 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,13 @@ python3 ontrack.py --config config.yaml --groups researchers ``` Directory : /data/projects/alice Username : alice -Groups : researchers +Group : researchers Files : 1042 Total size: 3.57 GB Directory : /data/projects/bob Username : bob -Groups : researchers +Group : researchers Files : 204 Total size: 512.00 MB ``` From ea3ed1e38371e84d5753953fb82ce3ac35da1b43 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:49:11 +0000 Subject: [PATCH 4/4] fix: change print label from 'Groups' to 'Group' to match docs Agent-Logs-Url: https://github.com/FertigLab/ontrack/sessions/ee930496-667f-4b2d-a188-1a05bbf1e9c0 Co-authored-by: dimalvovs <1246862+dimalvovs@users.noreply.github.com> --- ontrack.py | 2 +- tests/test_ontrack.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ontrack.py b/ontrack.py index b07c212..ee7686b 100644 --- a/ontrack.py +++ b/ontrack.py @@ -346,7 +346,7 @@ def report_directory( print(f"Directory : {entry['directory']}") print(f"Username : {entry['username']}") if "groups" in entry: - print(f"Groups : {', '.join(entry['groups'])}") + print(f"Group : {', '.join(entry['groups'])}") if "file_count" in entry: print(f"Files : {entry['file_count']}") print(f"Total size: {entry['total_size_human']}") diff --git a/tests/test_ontrack.py b/tests/test_ontrack.py index 29c0b78..9c9767d 100644 --- a/tests/test_ontrack.py +++ b/tests/test_ontrack.py @@ -278,7 +278,7 @@ def test_get_directory_stats_group_excludes_files(): def test_report_directory_with_group(capsys): - """report_directory prints the Groups line when groups are supplied.""" + """report_directory prints the Group line when groups are supplied.""" current_gid = os.getgid() group_name = grp.getgrgid(current_gid).gr_name @@ -288,19 +288,17 @@ def test_report_directory_with_group(capsys): report_directory(tmpdir, groups=[group_name]) captured = capsys.readouterr() - assert "Groups" in captured.out + assert "Group" in captured.out assert group_name in captured.out - - def test_report_directory_without_group_no_group_line(capsys): - """report_directory does not print a Groups line when no groups are given.""" + """report_directory does not print a Group line when no groups are given.""" with tempfile.TemporaryDirectory() as tmpdir: with open(os.path.join(tmpdir, "sample.txt"), "w") as f: f.write("data") report_directory(tmpdir) captured = capsys.readouterr() - assert "Groups" not in captured.out + assert "Group :" not in captured.out # --------------------------------------------------------------------------- @@ -326,7 +324,7 @@ def test_main_with_group(tmp_path, capsys): main(str(config_file), groups=[group_name]) captured = capsys.readouterr() assert str(user_subdir) in captured.out - assert "Groups" in captured.out + assert "Group" in captured.out assert group_name in captured.out @@ -356,7 +354,7 @@ def test_main_with_multiple_groups(tmp_path, capsys): main(str(config_file), groups=[group_name, second_group]) captured = capsys.readouterr() assert str(user_subdir) in captured.out - assert "Groups" in captured.out + assert "Group" in captured.out assert group_name in captured.out