bunq-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.
- {bunq_cli-0.2.0/src/bunq_cli.egg-info → bunq_cli-0.2.1}/PKG-INFO +1 -1
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/login.py +2 -2
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/profiles.py +4 -4
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/main.py +35 -2
- {bunq_cli-0.2.0 → bunq_cli-0.2.1/src/bunq_cli.egg-info}/PKG-INFO +1 -1
- bunq_cli-0.2.1/src/bunq_cli.egg-info/scm_version.json +8 -0
- bunq_cli-0.2.0/src/bunq_cli.egg-info/scm_version.json +0 -8
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/.github/workflows/release.yml +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/.gitignore +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/LICENSE +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/README.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/accounts.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/callbacks.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/cards.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/getting-started.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/payment-requests.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/docs/payments.md +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/pyproject.toml +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/setup.cfg +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/__init__.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/client.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/__init__.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/accounts.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/bunqme.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/callbacks.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/cards.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/drafts.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/events.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/oauth_client.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/payments.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/requests.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/sandbox.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/scheduled.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/commands/statements.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/config.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/oauth.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli/output.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/SOURCES.txt +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/dependency_links.txt +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/entry_points.txt +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/requires.txt +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/scm_file_list.json +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/src/bunq_cli.egg-info/top_level.txt +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/__init__.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/conftest.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_cli.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_commands/__init__.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_config.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_oauth.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_output.py +0 -0
- {bunq_cli-0.2.0 → bunq_cli-0.2.1}/tests/test_profiles.py +0 -0
|
@@ -17,7 +17,7 @@ from bunq_cli.config import (
|
|
|
17
17
|
set_profile,
|
|
18
18
|
validate_profile_name,
|
|
19
19
|
)
|
|
20
|
-
from bunq_cli.main import Context, pass_context
|
|
20
|
+
from bunq_cli.main import Context, complete_profile, pass_context
|
|
21
21
|
from bunq_cli.oauth import oauth_login
|
|
22
22
|
|
|
23
23
|
|
|
@@ -112,7 +112,7 @@ def login(
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
@click.command()
|
|
115
|
-
@click.option("--profile", "profile_name", default=None, help="Profile to log out (default: the selected profile).")
|
|
115
|
+
@click.option("--profile", "profile_name", default=None, shell_complete=complete_profile, help="Profile to log out (default: the selected profile).")
|
|
116
116
|
@click.option("--all", "all_profiles", is_flag=True, help="Log out of every profile.")
|
|
117
117
|
@pass_context
|
|
118
118
|
def logout(ctx: Context, profile_name: str | None, all_profiles: bool) -> None:
|
|
@@ -12,7 +12,7 @@ from bunq_cli.config import (
|
|
|
12
12
|
save_config,
|
|
13
13
|
validate_profile_name,
|
|
14
14
|
)
|
|
15
|
-
from bunq_cli.main import Context, pass_context
|
|
15
|
+
from bunq_cli.main import Context, complete_profile, pass_context
|
|
16
16
|
from bunq_cli.output import echo_output
|
|
17
17
|
|
|
18
18
|
|
|
@@ -42,7 +42,7 @@ def list_profiles(ctx: Context) -> None:
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
@profiles.command("use")
|
|
45
|
-
@click.argument("name")
|
|
45
|
+
@click.argument("name", shell_complete=complete_profile)
|
|
46
46
|
@pass_context
|
|
47
47
|
def use_profile(ctx: Context, name: str) -> None:
|
|
48
48
|
"""Set the default profile."""
|
|
@@ -55,7 +55,7 @@ def use_profile(ctx: Context, name: str) -> None:
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
@profiles.command("rename")
|
|
58
|
-
@click.argument("old")
|
|
58
|
+
@click.argument("old", shell_complete=complete_profile)
|
|
59
59
|
@click.argument("new")
|
|
60
60
|
@pass_context
|
|
61
61
|
def rename_profile(ctx: Context, old: str, new: str) -> None:
|
|
@@ -76,7 +76,7 @@ def rename_profile(ctx: Context, old: str, new: str) -> None:
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
@profiles.command("set")
|
|
79
|
-
@click.argument("name")
|
|
79
|
+
@click.argument("name", shell_complete=complete_profile)
|
|
80
80
|
@click.option("--read-only/--read-write", default=None, help="Block or allow commands that change data.")
|
|
81
81
|
@pass_context
|
|
82
82
|
def set_profile_options(ctx: Context, name: str, read_only: bool | None) -> None:
|
|
@@ -17,7 +17,7 @@ from bunq_cli.config import (
|
|
|
17
17
|
from bunq_cli.output import format_output
|
|
18
18
|
|
|
19
19
|
# Commands that manage profiles/credentials themselves and make no sense per profile.
|
|
20
|
-
SINGLE_PROFILE_COMMANDS = {"login", "logout", "profiles", "sandbox", "oauth-client"}
|
|
20
|
+
SINGLE_PROFILE_COMMANDS = {"login", "logout", "profiles", "sandbox", "oauth-client", "completion"}
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class Context:
|
|
@@ -121,6 +121,15 @@ def _run_for_all_profiles(ctx: Context) -> None:
|
|
|
121
121
|
click_ctx.exit(1 if failed else 0)
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
def complete_profile(ctx: click.Context, param: click.Parameter, incomplete: str) -> list[str]:
|
|
125
|
+
config_path = ctx.find_root().params.get("config_path") or DEFAULT_CONFIG_PATH
|
|
126
|
+
try:
|
|
127
|
+
profiles = load_config(config_path).get("profiles", {})
|
|
128
|
+
except Exception: # never break the shell over a bad config
|
|
129
|
+
return []
|
|
130
|
+
return [name for name in profiles if name.startswith(incomplete)]
|
|
131
|
+
|
|
132
|
+
|
|
124
133
|
@click.group(cls=_CliGroup)
|
|
125
134
|
@click.version_option(package_name="bunq-cli", prog_name="bunq")
|
|
126
135
|
@click.option("-v", "--verbose", is_flag=True, help="Enable verbose output.")
|
|
@@ -142,7 +151,14 @@ def _run_for_all_profiles(ctx: Context) -> None:
|
|
|
142
151
|
help="Custom config file path.",
|
|
143
152
|
)
|
|
144
153
|
@click.option("--sandbox", is_flag=True, help="Use the sandbox environment.")
|
|
145
|
-
@click.option(
|
|
154
|
+
@click.option(
|
|
155
|
+
"-p",
|
|
156
|
+
"--profile",
|
|
157
|
+
envvar="BUNQ_PROFILE",
|
|
158
|
+
default=None,
|
|
159
|
+
shell_complete=complete_profile,
|
|
160
|
+
help="Profile (client) to use. Env: BUNQ_PROFILE.",
|
|
161
|
+
)
|
|
146
162
|
@click.option("--all-profiles", is_flag=True, help="Run a read-only command for every profile.")
|
|
147
163
|
@pass_context
|
|
148
164
|
def cli(
|
|
@@ -177,6 +193,23 @@ def cli(
|
|
|
177
193
|
_run_for_all_profiles(ctx)
|
|
178
194
|
|
|
179
195
|
|
|
196
|
+
@cli.command()
|
|
197
|
+
@click.argument("shell", type=click.Choice(["bash", "zsh", "fish"]))
|
|
198
|
+
def completion(shell: str) -> None:
|
|
199
|
+
"""Print the shell completion script for SHELL.
|
|
200
|
+
|
|
201
|
+
\b
|
|
202
|
+
Install it with:
|
|
203
|
+
bash: echo 'eval "$(bunq completion bash)"' >> ~/.bashrc
|
|
204
|
+
zsh: echo 'eval "$(bunq completion zsh)"' >> ~/.zshrc
|
|
205
|
+
fish: bunq completion fish > ~/.config/fish/completions/bunq.fish
|
|
206
|
+
"""
|
|
207
|
+
from click.shell_completion import get_completion_class
|
|
208
|
+
|
|
209
|
+
comp_cls = get_completion_class(shell)
|
|
210
|
+
click.echo(comp_cls(cli, {}, "bunq", "_BUNQ_COMPLETE").source())
|
|
211
|
+
|
|
212
|
+
|
|
180
213
|
# Register commands
|
|
181
214
|
from bunq_cli.commands.login import login, logout # noqa: E402
|
|
182
215
|
from bunq_cli.commands.accounts import accounts # noqa: E402
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|