secshare-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.
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/PKG-INFO +1 -1
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/pyproject.toml +1 -1
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/secshare_cli/cli.py +16 -3
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/.gitignore +0 -0
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/README.md +0 -0
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/secshare_cli/__init__.py +0 -0
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/secshare_cli/api.py +0 -0
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/secshare_cli/config.py +0 -0
- {secshare_cli-0.2.0 → secshare_cli-0.2.1}/secshare_cli/crypto.py +0 -0
|
@@ -127,14 +127,20 @@ def whoami():
|
|
|
127
127
|
|
|
128
128
|
@cli.command()
|
|
129
129
|
@click.argument("link")
|
|
130
|
-
|
|
130
|
+
@click.option("--show", is_flag=True, help="Print plaintext to terminal (use only when not piping).")
|
|
131
|
+
def get(link, show):
|
|
131
132
|
"""Fetch and decrypt a secret.
|
|
132
133
|
|
|
133
134
|
\b
|
|
134
|
-
|
|
135
|
-
secshare get https://secshare.link/s/abc123#KEY
|
|
135
|
+
Inject .env secrets into your shell (recommended):
|
|
136
136
|
eval "$(secshare get https://secshare.link/s/abc123#KEY)"
|
|
137
|
+
|
|
138
|
+
\b
|
|
139
|
+
Explicitly print to terminal:
|
|
140
|
+
secshare get https://secshare.link/s/abc123#KEY --show
|
|
137
141
|
"""
|
|
142
|
+
import sys
|
|
143
|
+
|
|
138
144
|
try:
|
|
139
145
|
secret_id, key_fragment = _parse_link(link)
|
|
140
146
|
data = fetch_secret(secret_id)
|
|
@@ -144,6 +150,13 @@ def get(link):
|
|
|
144
150
|
except Exception as e:
|
|
145
151
|
raise click.ClickException(str(e))
|
|
146
152
|
|
|
153
|
+
if sys.stdout.isatty() and not show:
|
|
154
|
+
raise click.ClickException(
|
|
155
|
+
"Refusing to print secret to terminal.\n"
|
|
156
|
+
" To inject into your shell: eval \"$(secshare get <link>)\"\n"
|
|
157
|
+
" To print explicitly: secshare get <link> --show"
|
|
158
|
+
)
|
|
159
|
+
|
|
147
160
|
# .env payload — output KEY=VALUE lines
|
|
148
161
|
try:
|
|
149
162
|
parsed = json.loads(plaintext)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|