python-cath 0.3.0__tar.gz → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-cath
3
- Version: 0.3.0
3
+ Version: 0.4.1
4
4
  Summary: Cat files w/ headers
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -6,7 +6,7 @@ build-backend = "poetry.masonry.api"
6
6
 
7
7
  [tool.poetry]
8
8
  name = "python-cath"
9
- version = "0.3.0"
9
+ version = "0.4.1"
10
10
  description = "Cat files w/ headers"
11
11
  readme = "README.md"
12
12
  authors = [
@@ -0,0 +1,54 @@
1
+ # mypy: disable-error-code="attr-defined"
2
+
3
+ from typing import List
4
+
5
+ import typer
6
+ from python_cath import __version__
7
+ from python_cath.concat import concat
8
+ from rich.console import Console
9
+
10
+ app = typer.Typer(
11
+ name="python-cath",
12
+ help="Cat files w/ headers",
13
+ add_completion=False,
14
+ invoke_without_command=True,
15
+ no_args_is_help=True,
16
+ )
17
+ console = Console()
18
+
19
+
20
+ def version_callback(value: bool) -> None:
21
+ """Prints the version of the package."""
22
+ if value:
23
+ console.print(
24
+ f"[yellow]python-cath[/] version: [bold blue]{__version__}[/]"
25
+ )
26
+ raise typer.Exit()
27
+
28
+
29
+ @app.command()
30
+ def main(
31
+ files: List[str] = typer.Argument(
32
+ ...,
33
+ help="Two or more input files followed by the output file "
34
+ "(the last argument is the output).",
35
+ ),
36
+ ) -> None:
37
+ """Concatenate CSV files with a shared header.
38
+
39
+ Provide two or more input files followed by the output file as the
40
+ final argument, e.g. ``python-cath in1 in2 out``.
41
+ """
42
+ if len(files) < 3:
43
+ console.print(
44
+ "[red]Error:[/] need at least two input files plus an output "
45
+ "file; the last argument is the output and would otherwise "
46
+ "overwrite an input.",
47
+ )
48
+ raise typer.Exit(code=2)
49
+ *input_files, output_file = files
50
+ concat(input_files, output_file)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ app()
@@ -1,33 +0,0 @@
1
- # mypy: disable-error-code="attr-defined"
2
-
3
- from typing import List
4
-
5
- import typer
6
- from python_cath import __version__
7
- from python_cath.concat import concat
8
- from rich.console import Console
9
-
10
- app = typer.Typer(
11
- name="python-cath",
12
- help="Cat files w/ headers",
13
- add_completion=False,
14
- )
15
- console = Console()
16
-
17
-
18
- def version_callback(value: bool) -> None:
19
- """Prints the version of the package."""
20
- if value:
21
- console.print(
22
- f"[yellow]python-cath[/] version: [bold blue]{__version__}[/]"
23
- )
24
- raise typer.Exit()
25
-
26
-
27
- @app.command()
28
- def main(
29
- file_list: List[str] = typer.Argument(...),
30
- output_file: str = typer.Argument(...),
31
- ) -> None:
32
- """Concatenate CSV files with a shared header into output_file."""
33
- concat(file_list, output_file)
File without changes
File without changes