bt-cli 0.4.13__tar.gz → 0.4.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bt_cli-0.4.13 → bt_cli-0.4.15}/PKG-INFO +1 -1
- {bt_cli-0.4.13 → bt_cli-0.4.15}/pyproject.toml +1 -1
- bt_cli-0.4.15/scripts/sync-package-data.sh +21 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/config_file.py +14 -3
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/policies.py +17 -3
- bt_cli-0.4.15/src/bt_cli/pws/commands/import_export.py +627 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/secrets.py +5 -5
- bt_cli-0.4.13/src/bt_cli/pws/commands/import_export.py +0 -452
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.claude/skills/bt/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.claude/skills/entitle/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.claude/skills/epmw/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.claude/skills/pra/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.claude/skills/pws/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.env.example +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.github/workflows/ci.yml +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.github/workflows/release.yml +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/.gitignore +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/CLAUDE.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/README.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/assets/cli-help.png +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/assets/cli-output.png +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/bt-cli.spec +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/bt_entry.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/scripts/bt_entry.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/cli.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/commands/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/commands/configure.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/commands/learn.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/commands/quick.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/config.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/csv_utils.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/errors.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/output.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/prompts.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/core/rest_debug.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/CLAUDE.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/skills/bt/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/skills/entitle/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/skills/epmw/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/skills/pra/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/data/skills/pws/SKILL.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/client/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/client/base.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/accounts.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/applications.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/bundles.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/integrations.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/permissions.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/policies.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/resources.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/roles.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/users.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/commands/workflows.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/bundle.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/common.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/integration.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/permission.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/policy.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/resource.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/role.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/user.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/entitle/models/workflow.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/client/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/client/base.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/audits.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/computers.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/events.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/groups.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/quick.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/requests.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/roles.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/tasks.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/commands/users.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/epmw/models/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/client/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/client/base.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/import_export.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/jump_clients.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/jump_groups.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/jump_items.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/jumpoints.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/policies.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/quick.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/teams.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/users.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/commands/vault.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/common.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/jump_client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/jump_group.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/jump_item.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/jumpoint.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/team.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/user.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pra/models/vault.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/client/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/client/base.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/client/beyondinsight.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/client/passwordsafe.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/accounts.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/assets.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/clouds.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/config.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/credentials.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/databases.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/directories.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/functional.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/platforms.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/quick.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/search.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/systems.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/users.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/commands/workgroups.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/config.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/models/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/models/account.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/models/asset.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/models/common.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/src/bt_cli/pws/models/system.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/conftest.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/core/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/core/test_auth.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/core/test_config.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/core/test_errors.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/core/test_rest_debug.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/entitle/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/entitle/test_client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/entitle/test_commands.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/entitle-smoke-test.sh +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/epmw/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/epmw/test_client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/epmw/test_commands.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/epmw-quick-test-plan.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/fixtures/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/fixtures/responses.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/conftest.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/helpers.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_entitle_integration.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_epmw_integration.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_epmw_lifecycle.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_pra_integration.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_pra_lifecycle.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_pws_integration.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/integration/test_pws_lifecycle.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pra/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pra/test_client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pra/test_commands.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pra-smoke-test.sh +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pra-test-plan.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pws/__init__.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pws/test_client.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pws/test_commands.py +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pws-quick-test-plan.md +0 -0
- {bt_cli-0.4.13 → bt_cli-0.4.15}/tests/pws-smoke-test.sh +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Sync skills and CLAUDE.md to package data directory before building
|
|
3
|
+
# Run this before `python -m build` to ensure package has latest content
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
9
|
+
|
|
10
|
+
echo "Syncing package data..."
|
|
11
|
+
|
|
12
|
+
# Sync skills
|
|
13
|
+
rm -rf "$PROJECT_ROOT/src/bt_cli/data/skills"
|
|
14
|
+
cp -r "$PROJECT_ROOT/.claude/skills" "$PROJECT_ROOT/src/bt_cli/data/skills"
|
|
15
|
+
echo " ✓ Synced .claude/skills -> src/bt_cli/data/skills"
|
|
16
|
+
|
|
17
|
+
# Sync CLAUDE.md
|
|
18
|
+
cp "$PROJECT_ROOT/CLAUDE.md" "$PROJECT_ROOT/src/bt_cli/data/CLAUDE.md"
|
|
19
|
+
echo " ✓ Synced CLAUDE.md -> src/bt_cli/data/CLAUDE.md"
|
|
20
|
+
|
|
21
|
+
echo "Done. Ready to build."
|
|
@@ -205,6 +205,7 @@ def save_config_file(config: ConfigFile, path: Optional[Path] = None) -> None:
|
|
|
205
205
|
# This prevents TOCTOU race where file could be readable between
|
|
206
206
|
# creation and chmod.
|
|
207
207
|
import os
|
|
208
|
+
import sys
|
|
208
209
|
import tempfile
|
|
209
210
|
|
|
210
211
|
# Write to temp file in same directory, then atomic rename
|
|
@@ -213,12 +214,22 @@ def save_config_file(config: ConfigFile, path: Optional[Path] = None) -> None:
|
|
|
213
214
|
# Create temp file with secure permissions
|
|
214
215
|
fd, tmp_path = tempfile.mkstemp(dir=dir_path, prefix=".config_", suffix=".tmp")
|
|
215
216
|
try:
|
|
216
|
-
# Set permissions on file descriptor before writing
|
|
217
|
-
|
|
217
|
+
# Set permissions on file descriptor before writing (POSIX only)
|
|
218
|
+
# Windows doesn't support fchmod - permissions work differently there
|
|
219
|
+
if sys.platform != "win32" and hasattr(os, "fchmod"):
|
|
220
|
+
os.fchmod(fd, 0o600)
|
|
218
221
|
with os.fdopen(fd, "w") as f:
|
|
219
222
|
yaml.dump(data, f, default_flow_style=False, sort_keys=False)
|
|
220
|
-
# Atomic rename
|
|
223
|
+
# Atomic rename (on Windows, need to remove target first if exists)
|
|
224
|
+
if sys.platform == "win32" and path.exists():
|
|
225
|
+
os.unlink(path)
|
|
221
226
|
os.rename(tmp_path, path)
|
|
227
|
+
# On Windows, set permissions after the fact using chmod
|
|
228
|
+
if sys.platform == "win32":
|
|
229
|
+
try:
|
|
230
|
+
os.chmod(path, 0o600)
|
|
231
|
+
except OSError:
|
|
232
|
+
pass # Best effort on Windows
|
|
222
233
|
except Exception:
|
|
223
234
|
# Clean up temp file on error
|
|
224
235
|
try:
|
|
@@ -288,15 +288,29 @@ def revert_policy(
|
|
|
288
288
|
@app.command("download")
|
|
289
289
|
def download_policy(
|
|
290
290
|
policy_id: str = typer.Argument(..., help="Policy ID (UUID)"),
|
|
291
|
+
file: Optional[str] = typer.Option(None, "--file", "-f", help="Save to file instead of stdout"),
|
|
291
292
|
):
|
|
292
|
-
"""Download policy content (XML format).
|
|
293
|
+
"""Download policy content (XML format).
|
|
294
|
+
|
|
295
|
+
Examples:
|
|
296
|
+
bt epmw policies download <policy_id>
|
|
297
|
+
bt epmw policies download <policy_id> --file policy.xml
|
|
298
|
+
bt epmw policies download <policy_id> > policy.xml
|
|
299
|
+
"""
|
|
293
300
|
from bt_cli.epmw.client import get_client
|
|
294
301
|
|
|
295
302
|
try:
|
|
296
303
|
client = get_client()
|
|
297
304
|
content = client.download_policy(policy_id)
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
|
|
306
|
+
if file:
|
|
307
|
+
# Write to file
|
|
308
|
+
with open(file, "w", encoding="utf-8") as f:
|
|
309
|
+
f.write(content)
|
|
310
|
+
print_success(f"Policy saved to: {file}")
|
|
311
|
+
else:
|
|
312
|
+
# Output to stdout
|
|
313
|
+
typer.echo(content)
|
|
300
314
|
except httpx.HTTPStatusError as e:
|
|
301
315
|
print_api_error(e, "download policy")
|
|
302
316
|
raise typer.Exit(1)
|