Last active
August 14, 2025 02:48
-
-
Save birkin/3debb7fdc9b63a3fc8eb3e4ee37091e9 to your computer and use it in GitHub Desktop.
uv run gist experimentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = "==3.12.*" | |
| # /// | |
| """ | |
| Just replaces spaces with underscores; that's all! | |
| Part of experimentation for using `uv run THE-GIST-URL` | |
| Usage: | |
| $ uv run https://gist.github.com/birkin/3debb7fdc9b63a3fc8eb3e4ee37091e9 --source "foo bar" | |
| foo_bar | |
| """ | |
| import argparse | |
| def main( original: str ) -> None: | |
| ## transform, print | |
| result: str = original.replace(' ', '_') | |
| print(result) | |
| if __name__ == '__main__': | |
| ## parse args | |
| parser: argparse.ArgumentParser = argparse.ArgumentParser( | |
| description='replace spaces with underscores' | |
| ) | |
| parser.add_argument('--source', required=True, help='source string to process') | |
| args: argparse.Namespace = parser.parse_args() | |
| original: str = args.source | |
| main( original ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment