Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-03-24 - CLI Interactive Prompt Enhancements
**Learning:** For CLI tools that require external credentials (like API tokens), users often context-switch to find them. Providing specific navigation paths (e.g., "Account > My Account > API Tokens") or URL patterns directly in the prompt significantly reduces friction. Also, explicitly stating `(input hidden)` for `getpass` prompts prevents user confusion about whether input is being received.
**Action:** When designing CLI onboarding flows, always include "where to find this" hints for credentials and explicit feedback indicators for hidden inputs.
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,23 +712,25 @@
if not args.dry_run and sys.stdin.isatty():
if not profile_ids:
print(f"{Colors.CYAN}ℹ Profile ID is missing.{Colors.ENDC}")
print(f"{Colors.BLUE} (Tip: You can find this in your Control D dashboard URL: /profiles/<profile_id>){Colors.ENDC}")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (130/100) Warning

Line too long (130/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (130/100) Warning

Line too long (130/100)
p_input = input(f"{Colors.BOLD}Enter Control D Profile ID:{Colors.ENDC} ").strip()
if p_input:
profile_ids = [p.strip() for p in p_input.split(",") if p.strip()]

if not TOKEN:
print(f"{Colors.CYAN}ℹ API Token is missing.{Colors.ENDC}")
print(f"{Colors.BLUE} (Tip: Generate this in Account > My Account > API Tokens){Colors.ENDC}")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (107/100) Warning

Line too long (107/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (107/100) Warning

Line too long (107/100)
import getpass
t_input = getpass.getpass(f"{Colors.BOLD}Enter Control D API Token:{Colors.ENDC} ").strip()
t_input = getpass.getpass(f"{Colors.BOLD}Enter Control D API Token (input hidden):{Colors.ENDC} ").strip()

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (118/100) Warning

Line too long (118/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (118/100) Warning

Line too long (118/100)
if t_input:
TOKEN = t_input

if not profile_ids and not args.dry_run:
log.error("PROFILE missing and --dry-run not set. Provide --profiles or set PROFILE env.")
log.error("Profile ID is missing. Please provide it via --profiles argument or PROFILE environment variable.")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (118/100) Warning

Line too long (118/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (118/100) Warning

Line too long (118/100)
exit(1)

if not TOKEN and not args.dry_run:
log.error("TOKEN missing and --dry-run not set. Set TOKEN env for live sync.")
log.error("API Token is missing. Please provide it via TOKEN environment variable for live sync.")

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (106/100) Warning

Line too long (106/100)

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (106/100) Warning

Line too long (106/100)
exit(1)

warm_up_cache(folder_urls)
Expand Down
Loading