treex-cli 0.2.0__tar.gz → 0.2.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.
@@ -81,9 +81,9 @@ checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"
81
81
 
82
82
  [[package]]
83
83
  name = "crc32fast"
84
- version = "1.5.2"
84
+ version = "1.5.3"
85
85
  source = "registry+https://github.com/rust-lang/crates.io-index"
86
- checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
86
+ checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
87
87
  dependencies = [
88
88
  "cfg-if",
89
89
  ]
@@ -1411,7 +1411,7 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
1411
1411
 
1412
1412
  [[package]]
1413
1413
  name = "treex-native"
1414
- version = "0.2.0"
1414
+ version = "0.2.1"
1415
1415
  dependencies = [
1416
1416
  "gix",
1417
1417
  "pyo3",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "treex-native"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  edition = "2024"
5
5
 
6
6
  [lib]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: treex-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line directory tree utility with metadata and Git ignore support
5
5
  Author: Corey Goldberg
6
6
  Maintainer: Corey Goldberg
@@ -122,9 +122,8 @@ filtering is disabled. Use `--all` to include files ignored by Git.
122
122
  ## Usage
123
123
 
124
124
  ```
125
- usage: treex [-h] [-V] [-a] [-m] [-q] [-d] [-s] [-i PATTERN] [-e PATTERN]
126
- [-I PATTERN] [-E PATTERN] [-D DEPTH]
127
- [directory]
125
+ $ treex --help
126
+ usage: treex [OPTIONS] [directory]
128
127
 
129
128
  List directory contents as a tree with file and directory metadata.
130
129
 
@@ -99,9 +99,8 @@ filtering is disabled. Use `--all` to include files ignored by Git.
99
99
  ## Usage
100
100
 
101
101
  ```
102
- usage: treex [-h] [-V] [-a] [-m] [-q] [-d] [-s] [-i PATTERN] [-e PATTERN]
103
- [-I PATTERN] [-E PATTERN] [-D DEPTH]
104
- [directory]
102
+ $ treex --help
103
+ usage: treex [OPTIONS] [directory]
105
104
 
106
105
  List directory contents as a tree with file and directory metadata.
107
106
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "treex-cli"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description="Command-line directory tree utility with metadata and Git ignore support"
9
9
  license = "MIT"
10
10
  license-files = ["LICENSE"]
@@ -37,7 +37,7 @@ repository = "https://github.com/cgoldberg/treex"
37
37
 
38
38
  [dependency-groups]
39
39
  build = [
40
- "cibuildwheel==4.3.2",
40
+ "cibuildwheel==4.3.3",
41
41
  ]
42
42
  lint = [
43
43
  "ruff==0.17.1",
@@ -455,6 +455,7 @@ def parse_args(argv=None):
455
455
  parser = argparse.ArgumentParser(
456
456
  description="List directory contents as a tree "
457
457
  "with file and directory metadata.",
458
+ usage="treex [OPTIONS] [directory]",
458
459
  formatter_class=formatter,
459
460
  )
460
461
  parser.add_argument(
@@ -468,7 +469,7 @@ def parse_args(argv=None):
468
469
  "-V",
469
470
  "--version",
470
471
  action="version",
471
- version=(f"%(prog)s {__version__} "),
472
+ version=f"treex {__version__}",
472
473
  help="show version information and exit",
473
474
  )
474
475
  parser.add_argument(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: treex-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Command-line directory tree utility with metadata and Git ignore support
5
5
  Author: Corey Goldberg
6
6
  Maintainer: Corey Goldberg
@@ -122,9 +122,8 @@ filtering is disabled. Use `--all` to include files ignored by Git.
122
122
  ## Usage
123
123
 
124
124
  ```
125
- usage: treex [-h] [-V] [-a] [-m] [-q] [-d] [-s] [-i PATTERN] [-e PATTERN]
126
- [-I PATTERN] [-E PATTERN] [-D DEPTH]
127
- [directory]
125
+ $ treex --help
126
+ usage: treex [OPTIONS] [directory]
128
127
 
129
128
  List directory contents as a tree with file and directory metadata.
130
129
 
@@ -1103,89 +1103,108 @@ class TestArgumentParsing:
1103
1103
  args = treex.parse_args(["/tmp/project"])
1104
1104
  assert args.directory == Path("/tmp/project")
1105
1105
 
1106
+ @pytest.mark.parametrize("option", ["-h", "--help"])
1107
+ def test_custom_usage_in_help(self, option, capsys):
1108
+ with pytest.raises(SystemExit) as exc_info:
1109
+ treex.parse_args([option])
1110
+ assert exc_info.value.code == 0
1111
+ output = capsys.readouterr().out
1112
+ assert output.splitlines()[0] == "usage: treex [OPTIONS] [directory]"
1113
+
1106
1114
  @pytest.mark.parametrize("option", ["-V", "--version"])
1107
1115
  def test_version(self, option, capsys):
1108
1116
  with pytest.raises(SystemExit) as exc_info:
1109
1117
  treex.parse_args([option])
1110
1118
  assert exc_info.value.code == 0
1111
1119
  output = capsys.readouterr().out
1112
- assert treex.__version__ in output
1120
+ assert output.strip() == f"treex {treex.__version__}"
1113
1121
 
1114
- def test_all(self):
1115
- args = treex.parse_args(["--all"])
1122
+ @pytest.mark.parametrize("option", ["-a", "--all"])
1123
+ def test_all(self, option):
1124
+ args = treex.parse_args([option])
1116
1125
  assert args.all is True
1117
1126
 
1118
- def test_modified(self):
1119
- args = treex.parse_args(["--modified"])
1127
+ @pytest.mark.parametrize("option", ["-m", "--modified"])
1128
+ def test_modified(self, option):
1129
+ args = treex.parse_args([option])
1120
1130
  assert args.modified is True
1121
1131
 
1122
- def test_quiet(self):
1123
- args = treex.parse_args(["--quiet"])
1132
+ @pytest.mark.parametrize("option", ["-q", "--quiet"])
1133
+ def test_quiet(self, option):
1134
+ args = treex.parse_args([option])
1124
1135
  assert args.quiet is True
1125
1136
 
1126
- def test_dirs(self):
1127
- args = treex.parse_args(["--dirs"])
1137
+ @pytest.mark.parametrize("option", ["-d", "--dirs"])
1138
+ def test_dirs(self, option):
1139
+ args = treex.parse_args([option])
1128
1140
  assert args.dirs is True
1129
1141
 
1130
- def test_summary(self):
1131
- args = treex.parse_args(["--summary"])
1142
+ @pytest.mark.parametrize("option", ["-s", "--summary"])
1143
+ def test_summary(self, option):
1144
+ args = treex.parse_args([option])
1132
1145
  assert args.summary is True
1133
1146
 
1134
- def test_include(self):
1135
- args = treex.parse_args(["--include", "*.py"])
1147
+ @pytest.mark.parametrize("option", ["-i", "--include"])
1148
+ def test_include(self, option):
1149
+ args = treex.parse_args([option, "*.py"])
1136
1150
  assert args.include == "*.py"
1137
1151
 
1138
- def test_exclude(self):
1139
- args = treex.parse_args(["--exclude", "*.pyc"])
1152
+ @pytest.mark.parametrize("option", ["-e", "--exclude"])
1153
+ def test_exclude(self, option):
1154
+ args = treex.parse_args([option, "*.pyc"])
1140
1155
  assert args.exclude == "*.pyc"
1141
1156
 
1142
- def test_include_regex(self):
1143
- args = treex.parse_args(["--include-regex", r"\.py$"])
1157
+ @pytest.mark.parametrize("option", ["-I", "--include-regex"])
1158
+ def test_include_regex(self, option):
1159
+ args = treex.parse_args([option, r"\.py$"])
1144
1160
  assert args.include_regex == r"\.py$"
1145
1161
 
1146
- def test_exclude_regex(self):
1147
- args = treex.parse_args(["--exclude-regex", r"test_"])
1162
+ @pytest.mark.parametrize("option", ["-E", "--exclude-regex"])
1163
+ def test_exclude_regex(self, option):
1164
+ args = treex.parse_args([option, r"test_"])
1148
1165
  assert args.exclude_regex == r"test_"
1149
1166
 
1150
- def test_depth(self):
1151
- args = treex.parse_args(["--depth", "3"])
1167
+ @pytest.mark.parametrize("option", ["-D", "--depth"])
1168
+ def test_depth(self, option):
1169
+ args = treex.parse_args([option, "3"])
1152
1170
  assert args.depth == 3
1153
1171
 
1172
+ @pytest.mark.parametrize("option", ["-D", "--depth"])
1154
1173
  @pytest.mark.parametrize("depth", ["0", "-1"])
1155
- def test_depth_must_be_positive(self, depth, capsys):
1174
+ def test_depth_must_be_positive(self, option, depth, capsys):
1156
1175
  with pytest.raises(SystemExit) as exc_info:
1157
- treex.parse_args(["--depth", depth])
1176
+ treex.parse_args([option, depth])
1158
1177
  assert exc_info.value.code == 2
1159
1178
  assert "must be at least 1" in capsys.readouterr().err
1160
1179
 
1161
- def test_depth_must_be_integer(self, capsys):
1180
+ @pytest.mark.parametrize("option", ["-D", "--depth"])
1181
+ def test_depth_must_be_integer(self, option, capsys):
1162
1182
  with pytest.raises(SystemExit) as exc_info:
1163
- treex.parse_args(["--depth", "abc"])
1183
+ treex.parse_args([option, "abc"])
1164
1184
  assert exc_info.value.code == 2
1165
1185
  assert "must be a positive integer" in capsys.readouterr().err
1166
1186
 
1167
- def test_all_options_combined(self):
1187
+ def test_all_short_options_combined(self):
1168
1188
  args = treex.parse_args(
1169
1189
  [
1170
- "--all",
1171
- "--modified",
1172
- "--quiet",
1173
- "--dirs",
1174
- "--summary",
1175
- "--include",
1190
+ "-a",
1191
+ "-m",
1192
+ "-q",
1193
+ "-d",
1194
+ "-s",
1195
+ "-i",
1176
1196
  "*.py",
1177
- "--exclude",
1197
+ "-e",
1178
1198
  "test_*.py",
1179
- "--include-regex",
1199
+ "-I",
1180
1200
  r"^src/",
1181
- "--exclude-regex",
1201
+ "-E",
1182
1202
  r"(^|/)generated/",
1183
- "--depth",
1203
+ "-D",
1184
1204
  "3",
1185
1205
  "/tmp/project",
1186
1206
  ]
1187
1207
  )
1188
- assert args.directory == Path("/tmp/project")
1189
1208
  assert args.all is True
1190
1209
  assert args.modified is True
1191
1210
  assert args.quiet is True
@@ -1196,37 +1215,40 @@ class TestArgumentParsing:
1196
1215
  assert args.include_regex == r"^src/"
1197
1216
  assert args.exclude_regex == r"(^|/)generated/"
1198
1217
  assert args.depth == 3
1218
+ assert args.directory == Path("/tmp/project")
1199
1219
 
1200
- def test_all_short_options_combined(self):
1220
+ def test_all_long_options_combined(self):
1201
1221
  args = treex.parse_args(
1202
1222
  [
1203
- "-a",
1204
- "-m",
1205
- "-q",
1206
- "-d",
1207
- "-i",
1223
+ "--all",
1224
+ "--modified",
1225
+ "--quiet",
1226
+ "--dirs",
1227
+ "--summary",
1228
+ "--include",
1208
1229
  "*.py",
1209
- "-e",
1230
+ "--exclude",
1210
1231
  "test_*.py",
1211
- "-I",
1232
+ "--include-regex",
1212
1233
  r"^src/",
1213
- "-E",
1234
+ "--exclude-regex",
1214
1235
  r"(^|/)generated/",
1215
- "-D",
1236
+ "--depth",
1216
1237
  "3",
1217
- "-s",
1238
+ "/tmp/project",
1218
1239
  ]
1219
1240
  )
1220
1241
  assert args.all is True
1221
1242
  assert args.modified is True
1222
1243
  assert args.quiet is True
1223
1244
  assert args.dirs is True
1245
+ assert args.summary is True
1224
1246
  assert args.include == "*.py"
1225
1247
  assert args.exclude == "test_*.py"
1226
1248
  assert args.include_regex == r"^src/"
1227
1249
  assert args.exclude_regex == r"(^|/)generated/"
1228
1250
  assert args.depth == 3
1229
- assert args.summary is True
1251
+ assert args.directory == Path("/tmp/project")
1230
1252
 
1231
1253
 
1232
1254
  class TestMain:
File without changes
File without changes
File without changes
File without changes