Skip to content

Commit 1631a35

Browse files
committed
new cli cmd aliases, stacker list, stacker agent list
1 parent 698c6d6 commit 1631a35

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ The end-user tool. No server required for local deploys.
184184
| `stacker service list` | List available service templates (20+ built-in) |
185185
| `stacker agent health` | Check Status Panel agent connectivity and health |
186186
| `stacker agent status` | Display agent snapshot — containers, versions, uptime |
187+
| `stacker agent list apps` / `stacker agent apps` | List apps for the target deployment |
188+
| `stacker agent list containers` / `stacker agent containers` | List containers on the target server |
187189
| `stacker agent logs <app>` | Retrieve container logs from the remote agent |
188190
| `stacker agent restart <app>` | Restart a container via the agent |
189191
| `stacker agent deploy-app` | Deploy or update an app container on the target server. `--runtime kata\|runc` selects container runtime; `--env <name>` selects the deploy environment/profile |

src/bin/stacker.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,24 @@ enum AgentCommands {
13941394
#[command(subcommand)]
13951395
command: AgentListCommands,
13961396
},
1397+
/// List apps deployed for the target deployment (alias for `stacker agent list apps`)
1398+
Apps {
1399+
/// Output in JSON format
1400+
#[arg(long)]
1401+
json: bool,
1402+
/// Deployment hash
1403+
#[arg(long)]
1404+
deployment: Option<String>,
1405+
},
1406+
/// List containers running on the target server (alias for `stacker agent list containers`)
1407+
Containers {
1408+
/// Output in JSON format
1409+
#[arg(long)]
1410+
json: bool,
1411+
/// Deployment hash
1412+
#[arg(long)]
1413+
deployment: Option<String>,
1414+
},
13971415
/// Show agent and container status for the deployment
13981416
Status {
13991417
/// Output in JSON format
@@ -2465,6 +2483,12 @@ fn get_command(
24652483
Box::new(agent::AgentListContainersCommand::new(json, deployment))
24662484
}
24672485
},
2486+
AgentCommands::Apps { json, deployment } => {
2487+
Box::new(agent::AgentListAppsCommand::new(json, deployment))
2488+
}
2489+
AgentCommands::Containers { json, deployment } => {
2490+
Box::new(agent::AgentListContainersCommand::new(json, deployment))
2491+
}
24682492
AgentCommands::Status { json, deployment } => {
24692493
Box::new(agent::AgentStatusCommand::new(json, deployment))
24702494
}
@@ -3025,6 +3049,37 @@ mod tests {
30253049
);
30263050
}
30273051

3052+
#[test]
3053+
fn test_agent_apps_alias_parses() {
3054+
let parsed = Cli::try_parse_from([
3055+
"stacker",
3056+
"agent",
3057+
"apps",
3058+
"--deployment",
3059+
"deployment_demo",
3060+
"--json",
3061+
]);
3062+
3063+
assert!(parsed.is_ok(), "agent apps alias should parse successfully");
3064+
}
3065+
3066+
#[test]
3067+
fn test_agent_containers_alias_parses() {
3068+
let parsed = Cli::try_parse_from([
3069+
"stacker",
3070+
"agent",
3071+
"containers",
3072+
"--deployment",
3073+
"deployment_demo",
3074+
"--json",
3075+
]);
3076+
3077+
assert!(
3078+
parsed.is_ok(),
3079+
"agent containers alias should parse successfully"
3080+
);
3081+
}
3082+
30283083
#[test]
30293084
fn test_secrets_help_mentions_remote_modes() {
30303085
let mut command = Cli::command();

0 commit comments

Comments
 (0)