Skip to content

Commit

Permalink
Add directory command
Browse files Browse the repository at this point in the history
  • Loading branch information
Colonial-Dev committed Jan 16, 2025
1 parent 6667028 commit e973a55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ FROM fedora-toolbox:latest
PRESET cp-user
# Fix Unix and SELinux permission issues with rootless mounting of host files.
PRESET bind-fix
# Mount the SSH agent socket into the container. (Implies bind-fix)
# Mount the SSH agent socket into the container.
PRESET ssh-agent

# Copy my GNU Stow .dotfiles directory into the container.
Expand Down Expand Up @@ -146,14 +146,9 @@ RUN sh -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s --
# Rust needs a C/++ toolchain for building foreign dependencies.
RUN sudo dnf groupinstall -y "Development Tools"
RUN sudo dnf groupinstall -y "C Development Tools and Libraries"
RUN mkdir -p /home/$USER/.local/bin

# Mount my projects directory, as well as a host user binary directory.
#
# Combined with setting CARGO_INSTALL_ROOT, this means I can 'cargo install' binaries
# inside the container and use them outside it.
# Mount my projects directory.
CFG mount type=bind,src=$HOME/Documents/Projects,dst=/home/$USER/Projects
CFG mount type=bind,src=$HOME/.local/bin/cargo,dst=/home/$USER/.cargo/install/bin

# Commit the container, basing the name on the symlink used to invoke this definition.
COMMIT localhost/rust
Expand Down
2 changes: 2 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub enum Command {
Definitions,
/// Delete a container definition.
Delete { name: String, #[arg(short, long)] yes: bool },
/// Output the directory currently being used for definitions.
Directory,
/// Remove managed container(s).
Down (ContainerSet),
/// Edit an existing container definition.
Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ fn main() -> Result<()> {
match args.command {
Containers => list_containers()?,
Definitions => list_definitions()?,
Directory => {
println!(
"{}",
definition_directory()?.to_string_lossy()
)
},

Create { name } => Definition::create(name)?,
Edit { name } => Definition::edit(name)?,
Expand Down

0 comments on commit e973a55

Please sign in to comment.