Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion crates/deacon/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ pub enum Commands {
/// Skip postCreate lifecycle phase
#[arg(long)]
skip_post_create: bool,
/// Skip postAttach lifecycle phase
/// Skip postAttach lifecycle phase
#[arg(long)]
skip_post_attach: bool,
/// Skip non-blocking commands (postStart & postAttach phases)
Expand All @@ -523,6 +523,41 @@ pub enum Commands {
id_label: Vec<String>,
},

/// Convert an already-running container into a DevContainer by applying
/// configuration + image metadata, executing lifecycle hooks, and emitting
/// a JSON snapshot of the resulting configuration.
///
/// See `docs/subcommand-specs/set-up/SPEC.md` for the authoritative behavior.
#[cfg(feature = "full")]
SetUp {
/// Target container ID (required). The container must already exist.
#[arg(long)]
container_id: String,
/// Optional path to a devcontainer.json to layer on top of the
/// container's embedded image metadata.
#[arg(long)]
config: Option<PathBuf>,
/// Skip all lifecycle hooks (onCreate, updateContent, postCreate,
/// postStart, postAttach) and dotfiles installation.
#[arg(long)]
skip_post_create: bool,
/// Stop after the configured `waitFor` hook (default `updateContent`).
#[arg(long)]
skip_non_blocking_commands: bool,
/// Extra remote env to inject when running hooks (repeatable).
#[arg(long = "remote-env", action = clap::ArgAction::Append)]
remote_env: Vec<String>,
/// Include the (substituted) configuration in the JSON result.
#[arg(long)]
include_configuration: bool,
/// Include the (substituted) merged configuration in the JSON result.
#[arg(long)]
include_merged_configuration: bool,
/// Inside-container user data root (default `~/.devcontainer`).
#[arg(long)]
container_data_folder: Option<PathBuf>,
},

/// Stop and optionally remove development container or compose project
Down {
/// Remove containers after stopping them
Expand Down Expand Up @@ -1337,6 +1372,37 @@ impl Cli {

execute_run_user_commands(args).await
}
#[cfg(feature = "full")]
Some(Commands::SetUp {
container_id,
config,
skip_post_create,
skip_non_blocking_commands,
remote_env,
include_configuration,
include_merged_configuration,
container_data_folder,
}) => {
use crate::commands::set_up::{execute_set_up, SetUpArgs};

let args = SetUpArgs {
container_id,
// Per spec §2: --config is local to set-up and overrides
// the global --config when both are present.
config_path: config.or(self.config.clone()),
skip_post_create,
skip_non_blocking_commands,
remote_env,
include_configuration,
include_merged_configuration,
container_data_folder: container_data_folder
.or_else(|| self.container_data_folder.clone()),
docker_path: self.docker_path.clone(),
progress_tracker: progress_tracker.clone(),
};

execute_set_up(args).await
}
Some(Commands::Down {
remove,
all,
Expand Down
2 changes: 2 additions & 0 deletions crates/deacon/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub mod outdated;
pub mod read_configuration;
#[cfg(feature = "full")]
pub mod run_user_commands;
#[cfg(feature = "full")]
pub mod set_up;
pub mod shared;
#[cfg(feature = "full")]
pub mod templates;
Expand Down
Loading
Loading