Skip to content

Commit

Permalink
update to fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 4, 2026
1 parent 7d0b771 commit 28516b7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions local-app/python-tools/aws_config_editor/aws_config_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
from pathlib import Path


# ── Version ───────────────────────────────────────────────────────────────────

__version__ = "1.0.1"

# ── Defaults ──────────────────────────────────────────────────────────────────

DEFAULT_CONFIG = Path.home() / ".aws" / "config"
Expand Down Expand Up @@ -510,9 +514,9 @@ def _profile_from_template(

# ── CLI construction ──────────────────────────────────────────────────────────

def _add_pattern_args(p: argparse.ArgumentParser) -> None:
def _add_pattern_args(p: argparse.ArgumentParser, required: bool = False) -> None:
p.add_argument(
"--pattern", metavar="REGEX",
"--pattern", metavar="REGEX", required=required,
help="Profile name filter: full regex match (or substring with --substring)",
)
p.add_argument(
Expand All @@ -534,6 +538,9 @@ def build_parser() -> argparse.ArgumentParser:
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=__doc__,
)
parser.add_argument(
"--version", action="version", version=f"%(prog)s {__version__}",
)
parser.add_argument(
"--file", "-f",
default=str(DEFAULT_CONFIG),
Expand All @@ -552,8 +559,7 @@ def build_parser() -> argparse.ArgumentParser:

# delete
dp = sub.add_parser("delete", help="Delete profiles matching a pattern")
_add_pattern_args(dp)
dp.add_argument("--pattern", required=True, metavar="REGEX")
_add_pattern_args(dp, required=True)
_add_mutation_args(dp)
dp.set_defaults(func=cmd_delete)

Expand All @@ -564,8 +570,7 @@ def build_parser() -> argparse.ArgumentParser:
formatter_class=argparse.RawDescriptionHelpFormatter,
description=cmd_edit.__doc__,
)
_add_pattern_args(ep)
ep.add_argument("--pattern", required=True, metavar="REGEX")
_add_pattern_args(ep, required=True)
ep.add_argument("--key", required=True, metavar="KEY",
help="Config key whose value will be modified (e.g. source_profile)")
ep.add_argument("--search", required=True, metavar="SEARCH",
Expand Down

0 comments on commit 28516b7

Please sign in to comment.