Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for renamed package #147

Open
vic1707 opened this issue Jan 29, 2025 · 0 comments
Open

Allow for renamed package #147

vic1707 opened this issue Jan 29, 2025 · 0 comments

Comments

@vic1707
Copy link

vic1707 commented Jan 29, 2025

First, thank you for rust-script its awesome !

I have a script with the following script named display-tests

//! Requires library SDL2 to be installed
//! See: <https://docs.rs/embedded-graphics-simulator/latest/embedded_graphics_simulator/#setup>
//! ```cargo
//! [package]
//! name = "ceceti"
//! version = "0.0.0"
//! edition = "2021"
//!
//! [dependencies]
//! embedded-graphics-simulator = "0.7.0"
//! embedded-graphics = { version = "0.8.1", default-features = false, features = [
//!     "defmt",
//! ] }
//! embedded-menu = { version = "0.6.1", default-features = false }
//! embedded-layout = "*" ## sub dep of embedded-menu
//! ```
extern crate embedded_graphics_simulator;
extern crate embedded_graphics;
/* Modules */
#[path = "../src/menu.rs"]
mod menu;
/* Crate imports */
use menu::get_menu;
/* Dependencies */
use embedded_graphics::{pixelcolor::BinaryColor, prelude::Size, Drawable as _};
use embedded_graphics_simulator::{
	BinaryColorTheme, OutputSettingsBuilder, SimulatorDisplay, Window,
};

fn main() {
	let mut display = SimulatorDisplay::<BinaryColor>::new(Size::new(128, 64));
	let output_settings = OutputSettingsBuilder::new()
		.theme(BinaryColorTheme::OledBlue)
		.build();
	let mut window = Window::new("ceceti screen", &output_settings);

    // Menu
    let mut menu = get_menu();
	
    menu.update(&display);
	menu.draw(&mut display).unwrap();
    window.show_static(&display);
}

but the name field isn't used by rust-script

Image Image

Can we be allowed to override the package name with the Cargo.toml block, my menu module uses env!("CARGO_CRATE_NAME") so instead of

Image

I get

Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant