Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
humblepenguinn committed Sep 30, 2024
1 parent b2010e9 commit 95490e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
41 changes: 5 additions & 36 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ use std::{env, fs, path::PathBuf, process};

include!("src/bin/envio/clap_app.rs");

/*
* Main function of the build script
*/
fn main() {
let mut cmd = ClapApp::command();
let app_name = cmd.get_name().to_string();
Expand Down Expand Up @@ -35,13 +32,7 @@ fn main() {
println!("cargo:rustc-env=BUILD_VERSION={}", get_version());
}

/*
* Generate manpages for the application
@param cmd clap::Command
@param out_dir &str
@return std::io::Result<()>
*/
/// Generate manpages for the CLI application
fn generate_manpages(cmd: clap::Command, out_dir: &str) -> std::io::Result<()> {
let man = clap_mangen::Man::new(cmd);
let mut buffer: Vec<u8> = Default::default();
Expand All @@ -52,14 +43,7 @@ fn generate_manpages(cmd: clap::Command, out_dir: &str) -> std::io::Result<()> {
Ok(())
}

/*
* Generate completions for the application
@param cmd clap::Command
@param app_name &str
@param outdir &str
@return std::io::Result<()>
*/
/// Generate completions for the CLI application
fn generate_completions(
cmd: &mut clap::Command,
app_name: &str,
Expand All @@ -73,13 +57,7 @@ fn generate_completions(
Ok(())
}

/*
* Get the version of the application
* It will try to get the version using git describe
* If it fails it will use the version from the Cargo.toml file
@return String
*/
/// Get the version of the build
fn get_version() -> String {
let mut cmd = process::Command::new("git");

Expand All @@ -99,24 +77,15 @@ fn get_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
}

/*
* Get the build timestamp
@return String
*/
/// Get the build timestamp
fn get_buildtimestamp() -> String {
return chrono::Local::now()
.naive_local()
.format("%Y-%m-%d %H:%M:%S")
.to_string();
}

/*
* Auxiliary function
* Create a directory if it does not exist
@param dir_name &str
*/
/// Auxilliary function to create a directory
fn create_dir(dir_name: &str) -> Result<(), std::io::Error> {
fs::create_dir_all(dir_name)?;

Expand Down
10 changes: 2 additions & 8 deletions src/bin/envio/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ fn get_userkey() -> String {
}
}

/**
* Check to see if the user is using a vi based editor so that we can use the vim mode in the inquire crate
@return Result<bool, String>
*/
/// Check to see if the user is using a vi based editor so that we can use the vim mode in the inquire crate
fn get_vim_mode() -> Result<bool> {
let env = env::var("VISUAL").unwrap_or_else(|_| env::var("EDITOR").unwrap_or_default());

Expand All @@ -57,9 +53,7 @@ fn get_vim_mode() -> Result<bool> {
}

impl Command {
/**
* Run the subcommand that was passed to the program
*/
/// Run the subcommand that was passed to the CLI
pub fn run(&self) -> Result<()> {
let vim_mode = get_vim_mode().unwrap_or(false);

Expand Down

0 comments on commit 95490e4

Please sign in to comment.