chore: ran cargo fmt
This commit is contained in:
@@ -389,7 +389,7 @@ pub mod wifi {
|
||||
Err("wifi::disconnect not supported on this OS".into())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Disables the Wi-Fi adapter.
|
||||
///
|
||||
/// # Arguments
|
||||
@@ -502,15 +502,15 @@ pub mod wifi {
|
||||
///
|
||||
/// Returns the state of the adapter as a `string` and returns an error if getting the state failed.
|
||||
///
|
||||
/// **Possible returns in Linux:**
|
||||
/// **Possible returns in Linux:**
|
||||
///
|
||||
/// - `"full"` (internet available)
|
||||
/// - `"limited"` (network only, no internet)
|
||||
/// - `"portal"` (captive portal)
|
||||
/// - `"none"` (no connectivity)
|
||||
///
|
||||
/// **Possible returns in macOS:**
|
||||
///
|
||||
/// **Possible returns in macOS:**
|
||||
///
|
||||
/// - `"full"` (connected to a Wi-Fi network)
|
||||
/// - `"none"` (not connected)
|
||||
///
|
||||
@@ -565,4 +565,3 @@ pub mod wifi {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
for providing data or doing certain actions.
|
||||
*/
|
||||
|
||||
mod apilib;
|
||||
mod builtin_signals;
|
||||
mod helper;
|
||||
mod stdlib;
|
||||
mod apilib;
|
||||
|
||||
use crate::module_resolver::{ChainedResolver, SimpleFileResolver};
|
||||
use rhai::module_resolvers::StaticModuleResolver;
|
||||
|
||||
use builtin_signals::register_all_signals;
|
||||
// expose the api's publically
|
||||
pub use stdlib::register_stdlib;
|
||||
pub use apilib::register_apilib;
|
||||
pub use stdlib::register_stdlib;
|
||||
|
||||
pub fn register_all_providers(engine: &mut rhai::Engine) {
|
||||
let mut resolver = StaticModuleResolver::new();
|
||||
|
||||
@@ -11,13 +11,13 @@ pub mod env {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// This function returns the value of the environment variable as a `String`.
|
||||
/// This function returns the value of the environment variable as a `String`.
|
||||
/// If the variable is not found or there is an error, it returns a `Result::Err` with the error message.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```js
|
||||
/// import "std::env" as env;
|
||||
/// import "std::env" as env;
|
||||
///
|
||||
/// // Get the value of the "HOME" environment variable
|
||||
/// let home_dir = env::get_env("HOME");
|
||||
@@ -42,7 +42,7 @@ pub mod env {
|
||||
/// # Example
|
||||
///
|
||||
/// ```js
|
||||
/// import "std::env" as env;
|
||||
/// import "std::env" as env;
|
||||
///
|
||||
/// // Set the value of the "MY_VAR" environment variable
|
||||
/// env::set_env("MY_VAR", "SomeValue");
|
||||
|
||||
@@ -7,9 +7,7 @@ use rhai::exported_module;
|
||||
use rhai::module_resolvers::StaticModuleResolver;
|
||||
|
||||
pub fn register_stdlib(resolver: &mut StaticModuleResolver) {
|
||||
use crate::providers::stdlib::{
|
||||
command::command, env::env, monitor::monitor, text::text,
|
||||
};
|
||||
use crate::providers::stdlib::{command::command, env::env, monitor::monitor, text::text};
|
||||
|
||||
// adding modules
|
||||
let text_mod = exported_module!(text);
|
||||
|
||||
@@ -75,10 +75,7 @@ pub mod monitor {
|
||||
/// print(resolutions); // Output: [[width1, height1], [width2, height2], ...]
|
||||
/// ```
|
||||
pub fn all_resolutions() -> Vec<[i64; 2]> {
|
||||
get_all_monitor_resolutions()
|
||||
.into_iter()
|
||||
.map(|(w, h)| [w, h])
|
||||
.collect()
|
||||
get_all_monitor_resolutions().into_iter().map(|(w, h)| [w, h]).collect()
|
||||
}
|
||||
|
||||
/// Get the resolutions of all connected monitors as a string.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rhai::{Engine, module_resolvers::StaticModuleResolver};
|
||||
use std::{env, fs, path::Path};
|
||||
use iirhai::providers;
|
||||
use rhai::{Engine, module_resolvers::StaticModuleResolver};
|
||||
use rhai_autodocs::{export::options, generate::mdbook};
|
||||
use std::{env, fs, path::Path};
|
||||
|
||||
fn generate_docs(engine: &Engine, path: &str, filename: &str, include_std: bool) {
|
||||
let docs = options()
|
||||
@@ -18,7 +18,8 @@ fn generate_docs(engine: &Engine, path: &str, filename: &str, include_std: bool)
|
||||
}
|
||||
|
||||
// Combine all module docs into one
|
||||
let full_docs = docs_content.into_iter().map(|(_, doc)| doc).collect::<Vec<String>>().join("\n");
|
||||
let full_docs =
|
||||
docs_content.into_iter().map(|(_, doc)| doc).collect::<Vec<String>>().join("\n");
|
||||
|
||||
// Write documentation to markdown file
|
||||
let file_path = Path::new(path).join(format!("{}.md", filename));
|
||||
@@ -28,11 +29,7 @@ fn generate_docs(engine: &Engine, path: &str, filename: &str, include_std: bool)
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let path = if args.len() > 1 {
|
||||
&args[1]
|
||||
} else {
|
||||
"./docs/src/modules"
|
||||
};
|
||||
let path = if args.len() > 1 { &args[1] } else { "./docs/src/modules" };
|
||||
|
||||
// engine/resolver
|
||||
let engine = Engine::new();
|
||||
|
||||
Reference in New Issue
Block a user