#!/usr/bin/env python3 """ This is a tiny script I can use to preview secrets on the command line. It prints the beginning and end of the secret, but not the whole thing -- this avoids printing secrets in plaintext. $ echo "$FLICKR_API_KEY" | peek ae8…f3a """ import sys if __name__ == '__main__': secret = sys.stdin.read().strip() if not secret: print("") elif len(secret) < 4: print(f"{secret[0]}…") elif len(secret) < 12: print(f"{secret[:3]}…") else: print(f"{secret[:3]}…{secret[-3:]}")