cubic 0.13.0

Cubic is a lightweight command line manager for virtual machines. It has a simple, daemon-less and rootless design. All Cubic virtual machines run isolated in the user context. Cubic is built on top of QEMU, KVM and cloud-init. Show all supported images: $ cubic image ls Create a new virtual machine instance: $ cubic add mymachine --image ubuntu:noble List all virtual machine instances: $ cubic ls Start an instance: $ cubic start <instance name> Stop an instance: $ cubic stop <instance name> Open a shell in the instance: $ cubic ssh <machine name> Copy a file from the host to the instance: $ cubic scp <path/to/host/file> <machine>:<path/to/guest/file> Copy a file from the instance to the hots: $ cubic scp <machine>:<path/to/guest/file> <path/to/host/file>
mod hostfwd;

use crate::error::Error;
use crate::instance::InstanceDao;

use clap::Subcommand;
use hostfwd::HostfwdCommands;

#[derive(Subcommand)]
pub enum NetworkCommands {
    /// Guest to host port forwarding commands (Deprecated)
    ///
    /// List forwarded ports for all instances:
    /// $ cubic net hostfwd list
    ///
    /// Forward guest SSH port (TCP port 22) to host on port 8000:
    /// $ cubic net hostfwd add myinstance tcp:127.0.0.1:8000-:22
    ///
    /// Remove port forwarding:
    /// $ cubic net hostfwd del myinstance tcp:127.0.0.1:8000-:22
    #[command(subcommand, verbatim_doc_comment)]
    Hostfwd(HostfwdCommands),
}

impl NetworkCommands {
    pub fn dispatch(&self, instance_dao: &InstanceDao) -> Result<(), Error> {
        match self {
            NetworkCommands::Hostfwd(command) => command.dispatch(instance_dao),
        }
    }
}