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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: secshare-cli
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: CLI for SecShare — zero-knowledge secret sharing
5
5
  Project-URL: Homepage, https://secshare.link
6
6
  Project-URL: Source, https://github.com/rdney/secshare
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "secshare-cli"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "CLI for SecShare — zero-knowledge secret sharing"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -127,14 +127,20 @@ def whoami():
127
127
 
128
128
  @cli.command()
129
129
  @click.argument("link")
130
- def get(link):
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
- Examples:
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