Skip to content
Snippets Groups Projects
Select Git revision
  • 08fa245d8c79baab3846c71a734207d3370df285
  • main default protected
2 results

lib.rs

Blame
  • lib.rs 726 B
    #![doc = include_str!("../README.md")]
    
    mod link;
    mod new;
    pub mod rel_iter;
    pub mod symbols;
    
    use anyhow::Result;
    use clap::{Parser, Subcommand};
    
    #[derive(Parser, Debug)]
    #[command(version, about, long_about = None)]
    pub struct Opts {
        #[command(subcommand)]
        command: TrollSubcommand,
    }
    
    #[derive(Subcommand, Debug)]
    pub enum TrollSubcommand {
        /// Generate a new project
        New(new::Opts),
        /// Link elf files together and generate a Troll binary blob ready to be flashed/loaded
        Link(link::Opts),
    }
    
    pub fn execute(opts: Opts) -> Result<()> {
        match opts.command {
            TrollSubcommand::New(opts) => new::generate(opts)?,
            TrollSubcommand::Link(opts) => link::link(opts)?,
        }
        Ok(())
    }