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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ embedded-io = { version = "0.7", features = ["alloc"] }
embedded-tls = { version = "0.19", default-features = false, features = [
"alloc",
] }
getargs-derive = { git = "https://github.com/AlixANNERAUD/getargs-derive.git", branch = "main" }

[workspace]
members = [
Expand All @@ -153,7 +154,6 @@ members = [
"executables/file_manager",
"executables/shell/command_line",
"modules/executable",
"modules/executable/macros",
"executables/wasm",
"executables/wasm/bindings",
"executables/wasm/tests/wasm_test",
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2024"
[dependencies]
xila = { path = "../../../" }
getargs = { version = "0.5" }
executable_macros = { path = "../../../modules/executable/macros" }
getargs-derive = { workspace = true }

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dev-dependencies]
drivers_native = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions executables/shell/command_line/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"Argument parsing error: {}": "Argument parsing error: {}",
"Accessed": "Accessed",
"Authentication failed: {}": "Authentication failed: {}",
"Cannot resolve {}: Unknown host": "Cannot resolve {}: Unknown host",
Expand Down
1 change: 1 addition & 0 deletions executables/shell/command_line/locales/fr.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"Argument parsing error: {}": "Erreur d'analyse des arguments: {}",
"Accessed": "Accédé",
"Authentication failed: {}": "Échec de l'authentification: {}",
"Cannot resolve {}: Unknown host": "Impossible de résoudre {}: Hôte inconnu",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Error, Result};
use alloc::borrow::ToOwned;
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::Path,
virtual_file_system::{self, Directory},
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/clear.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::Result;
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::file_system::Path;

use super::{CommandContext, UserCommand};
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/directory.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Error, Result};
use alloc::borrow::ToOwned;
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::{
file_system::{Kind, Path},
virtual_file_system::{self, Directory},
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/dns.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::Result;
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::{
file_system::Path,
internationalization::translate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Error, Result};
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::{file_system::Path, task};

use super::{CommandContext, UserCommand};
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/exit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::file_system::Path;

use crate::Result;
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/head.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Error, Result};
use alloc::{borrow::ToOwned, vec::Vec};
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::{AccessFlags, Path},
virtual_file_system::{self, File},
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/ip.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::error::{Error, Result};
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::{AccessFlags, Path},
log,
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Error, Result};
use alloc::borrow::ToOwned;
use alloc::string::ToString;
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::{Kind, Path},
log, users,
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/ping.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::Path,
internationalization::translate,
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/statistics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Error, Result};
use alloc::{borrow::ToOwned, format, string::String};
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::{
file_system::Path,
internationalization::translate,
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/tail.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Error, Result};
use alloc::{borrow::ToOwned, vec::Vec};
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::{AccessFlags, Path},
virtual_file_system::{self, File},
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/which.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::borrow::ToOwned;
use executable_macros::GetArgs;
use getargs::Options;
use getargs_derive::GetArgs;
use xila::{file_system::Path, virtual_file_system};

use crate::{Result, error::Error, resolver::resolve};
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/command_line/src/commands/word_count.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Error, Result};
use alloc::borrow::ToOwned;
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::{
file_system::{AccessFlags, Path},
virtual_file_system::{self, File},
Expand Down
10 changes: 10 additions & 0 deletions executables/shell/command_line/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub enum Error {
FailedToReadFile(virtual_file_system::Error),
RequiresValue,
DoesNotRequireValue,
ArgumentParsing(getargs_derive::Error),
InvalidArgument,
MissingPositionalArgument(&'static str),
InvalidOption,
Expand All @@ -55,6 +56,12 @@ impl<A: getargs::Argument> From<getargs::Error<A>> for Error {
}
}

impl From<getargs_derive::Error> for Error {
fn from(value: getargs_derive::Error) -> Self {
Error::ArgumentParsing(value)
}
}

impl Error {
pub fn get_discriminant(&self) -> NonZeroU16 {
unsafe { *<*const _>::from(self).cast::<NonZeroU16>() }
Expand Down Expand Up @@ -188,6 +195,9 @@ impl Display for Error {
Error::FailedToCreateSocket(error) => {
write!(formatter, translate!("Failed to create socket: {}"), error)
}
Error::ArgumentParsing(error) => {
write!(formatter, translate!("Argument parsing error: {}"), error)
}
Error::Format => {
write!(formatter, translate!("Format error"))
}
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/graphical/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
xila = { path = "../../../", features = ["graphics"] }
miniserde = { workspace = true }
getargs = { version = "0.5" }
executable_macros = { path = "../../../modules/executable/macros" }
getargs-derive = { workspace = true }

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dev-dependencies]
drivers_native = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion executables/shell/graphical/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use alloc::{boxed::Box, string::String, vec::Vec};
use core::fmt::Write;
use core::num::NonZeroUsize;
use core::time::Duration;
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use home::Home;
use layout::Layout;
use login::Login;
Expand Down
2 changes: 1 addition & 1 deletion executables/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ wamr-rust-sdk = { git = "https://github.com/bytecodealliance/wamr-rust-sdk.git",
"instruction-metering",
], optional = true }
getargs = { version = "0.5" }
executable_macros = { path = "../../modules/executable/macros" }
getargs-derive = { workspace = true }
smol_str = { workspace = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion executables/wasm/src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloc::string::ToString;
use alloc::{borrow::ToOwned, string::String, vec, vec::Vec};
use core::fmt::Write;
use core::num::{NonZeroU32, NonZeroUsize};
use executable_macros::GetArgs;
use getargs_derive::GetArgs;
use xila::executable::ExecutableTrait;
use xila::executable::MainFuture;
use xila::executable::Standard;
Expand Down
14 changes: 14 additions & 0 deletions executables/wasm/src/host/virtual_machine/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ impl From<RuntimeError> for Error {
}
}
}
impl From<getargs_derive::Error> for Error {
fn from(value: getargs_derive::Error) -> Self {
match value {
getargs_derive::Error::MissingPositionalArgument(name) => {
Error::MissingPositionalArgument(name)
}
getargs_derive::Error::UnknownOption => Error::InvalidOption,
getargs_derive::Error::MissingOptionValue(name) => Error::MissingArgument(name),
getargs_derive::Error::ParseError(_) => Error::InvalidOption,
getargs_derive::Error::InvalidNumberOfArguments => Error::InvalidNumberOfArguments,
}
}
}

impl From<task::Error> for Error {
fn from(error: task::Error) -> Self {
Error::FailedToGetTaskInformations(error)
Expand Down
15 changes: 0 additions & 15 deletions modules/executable/macros/Cargo.toml

This file was deleted.

Loading
Loading