desfr 0.1.0__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.
desfr-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: desfr
3
+ Version: 0.1.0
4
+ Summary: A dead simple CLI file reader
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+
8
+ # desfr
9
+
10
+ A dead simple command-line file reader.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install desfr
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Read a text file:
21
+
22
+ ```bash
23
+ desfr read filename.txt
24
+ ```
25
+
26
+ You can also provide an absolute path:
27
+
28
+ ```bash
29
+ desfr read /path/to/filename.txt
30
+ ```
31
+
32
+ Currently supports `.txt` files.
desfr-0.1.0/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # desfr
2
+
3
+ A dead simple command-line file reader.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install desfr
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Read a text file:
14
+
15
+ ```bash
16
+ desfr read filename.txt
17
+ ```
18
+
19
+ You can also provide an absolute path:
20
+
21
+ ```bash
22
+ desfr read /path/to/filename.txt
23
+ ```
24
+
25
+ Currently supports `.txt` files.
File without changes
@@ -0,0 +1,33 @@
1
+ import argparse
2
+ from pathlib import Path
3
+
4
+ def main():
5
+ parser = argparse.ArgumentParser(
6
+ description="A dead simple file reader in CLI"
7
+ )
8
+
9
+ subparsers = parser.add_subparsers(dest="command", required=True)
10
+
11
+ read_parser = subparsers.add_parser("read", help="Read a text file")
12
+ read_parser.add_argument("filename")
13
+
14
+ args = parser.parse_args()
15
+
16
+ if args.command == "read":
17
+ file = Path(args.filename)
18
+
19
+ if file.suffix.lower() != ".txt":
20
+ parser.error("Error: Only text files are supported for now")
21
+
22
+ if not file.exists():
23
+ parser.error(f"Error: The File '{args.filename}' does not exist")
24
+ return
25
+ try:
26
+ content = file.read_text(encoding="utf-8")
27
+
28
+ print(content, end="")
29
+ except OSError as e:
30
+ parser.error(f"Cannot read file: {e}")
31
+
32
+ if __name__ == "__main__":
33
+ main()
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: desfr
3
+ Version: 0.1.0
4
+ Summary: A dead simple CLI file reader
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+
8
+ # desfr
9
+
10
+ A dead simple command-line file reader.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install desfr
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Read a text file:
21
+
22
+ ```bash
23
+ desfr read filename.txt
24
+ ```
25
+
26
+ You can also provide an absolute path:
27
+
28
+ ```bash
29
+ desfr read /path/to/filename.txt
30
+ ```
31
+
32
+ Currently supports `.txt` files.
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ desfr/__init__.py
4
+ desfr/cli.py
5
+ desfr.egg-info/PKG-INFO
6
+ desfr.egg-info/SOURCES.txt
7
+ desfr.egg-info/dependency_links.txt
8
+ desfr.egg-info/entry_points.txt
9
+ desfr.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ desfr = desfr.cli:main
@@ -0,0 +1 @@
1
+ desfr
@@ -0,0 +1,13 @@
1
+ [build-system]
2
+ requires=["setuptools"]
3
+ build-backend="setuptools.build_meta"
4
+
5
+ [project]
6
+ name="desfr"
7
+ version="0.1.0"
8
+ description="A dead simple CLI file reader"
9
+ readme = "README.md"
10
+ requires-python=">=3.8"
11
+
12
+ [project.scripts]
13
+ desfr="desfr.cli:main"
desfr-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+