sync: auto-sync from HOWARD-HOME at 2026-07-06 16:10:24

Author: Howard Enos
Machine: HOWARD-HOME
Timestamp: 2026-07-06 16:10:24
This commit is contained in:
2026-07-06 16:10:52 -07:00
parent 8f4984c5a6
commit 7dc519827c
6 changed files with 186 additions and 52 deletions

View File

@@ -5,8 +5,12 @@ Read-only subcommands run freely. State-changing subcommands (send-command,
send-message, set-properties) refuse to run without --confirm.
Usage:
python sc.py status # auth check + instance info
python sc.py sessions [--name NAME] [--json]
python sc.py status # auth check + fleet counts
python sc.py sessions # whole Access fleet
python sc.py sessions --company "Safesite" # one client
python sc.py sessions --like DELL # partial name match
python sc.py sessions --name HOST # exact name
python sc.py sessions --filter "SessionType = 'Access'" # raw filter
python sc.py session <sessionID> # full session detail
python sc.py send-command --session <id> --command "..." --confirm
python sc.py send-message --session <id> --message "..." --confirm
@@ -97,20 +101,41 @@ def _gated(action_desc: str, confirm: bool) -> bool:
# --- handlers ---
def cmd_status(client, args):
# Auth check via the one verified method; report instance + custom-property map.
sessions = client.get_sessions_by_name("")
n = len(sessions) if isinstance(sessions, list) else 0
# Auth check via the fleet filter; report instance + custom-property map + counts.
access = client.list_sessions(session_type="access")
support = client.list_sessions(session_type="support")
na = len(access) if isinstance(access, list) else 0
ns = len(support) if isinstance(support, list) else 0
print(f"[OK] Authenticated to {SC_BASE_URL}")
print(f" extension: {client.extension_guid}")
print(f" custom properties: {CUSTOM_PROPERTIES}")
print(f" GetSessionsByName('') returned {n} session(s)")
print(f" fleet: {na} Access (unattended) + {ns} Support session(s)")
return 0
def cmd_sessions(client, args):
_print_sessions(client.get_sessions_by_name(args.name)) if not args.json else _emit(
client.get_sessions_by_name(args.name), True
)
# Full-fleet listing is the default (no selector -> every Access session).
# A raw --filter wins; otherwise build a filter from the structured flags.
if args.filter:
data = client.get_sessions_by_filter(args.filter)
else:
data = client.list_sessions(
session_type=args.type,
name=args.name or None,
name_like=args.like,
company=args.company,
site=args.site,
tag=args.tag,
)
if isinstance(data, list) and args.limit and len(data) > args.limit:
shown = data[: args.limit]
if args.json:
_emit(shown, True)
else:
_print_sessions(shown)
print(f" ... {len(data) - args.limit} more (raise --limit or use --json)")
return 0
_emit(data, True) if args.json else _print_sessions(data)
return 0
@@ -192,8 +217,19 @@ def build_parser() -> argparse.ArgumentParser:
sub.add_parser("status", help="Auth check + instance info.", parents=[common])
sp = sub.add_parser("sessions", help="List sessions by Name (verified).", parents=[common])
sp.add_argument("--name", default="", help="Session Name filter (blank = unattended).")
sp = sub.add_parser("sessions",
help="List sessions (default = whole Access fleet).",
parents=[common])
sp.add_argument("--name", default="", help="Exact session Name match.")
sp.add_argument("--like", help="Partial Name match (wrapped in *...*).")
sp.add_argument("--company", help="Filter by CP1 = Company.")
sp.add_argument("--site", help="Filter by CP2 = Site.")
sp.add_argument("--tag", help="Filter by CP3 = Tag.")
sp.add_argument("--type", default="access",
help="access (default) | support | meeting | all.")
sp.add_argument("--filter", help="Raw session-filter expression (overrides the flags).")
sp.add_argument("--limit", type=int, default=0,
help="Cap rows printed (0 = no cap; --json is always full).")
sp = sub.add_parser("session", help="Session detail.", parents=[common])
sp.add_argument("session_id")