ksefik 0.2.0__py3-none-any.whl

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.
ksefik/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ """ksefik - przeglądanie i wystawianie faktur w KSeF z terminala."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ from .config import ENVIRONMENTS, __version__, default_profile_path
10
+ from .profile import Profile, ProfileError, load_profile
11
+
12
+ __all__ = ["__version__", "main"]
13
+
14
+
15
+ def main() -> None:
16
+ parser = argparse.ArgumentParser(
17
+ prog="ksefik",
18
+ description="Przeglądanie i wystawianie faktur w Krajowym Systemie e-Faktur.",
19
+ epilog=f"Profil: {default_profile_path()} (inny wskażesz przez --profile albo KSEFIK_PROFILE).",
20
+ )
21
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
22
+ parser.add_argument("--env", choices=list(ENVIRONMENTS), help="środowisko KSeF (nadpisuje profil)")
23
+ parser.add_argument("--profile", type=Path, metavar="PLIK", help="plik profilu firmy (profile.toml)")
24
+ args = parser.parse_args()
25
+
26
+ path = (args.profile or default_profile_path()).expanduser()
27
+ profile: Profile | None = None
28
+ try:
29
+ if path.exists():
30
+ profile = load_profile(path, args.env)
31
+ except ProfileError as exc:
32
+ sys.exit(str(exc))
33
+
34
+ from .ui.app import KsefApp
35
+
36
+ KsefApp(profile, profile_path=path, env_override=args.env).run()