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

WIP chmod #143

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ codegen-units = 1
members = [
"basename",
"cat",
"chmod",
"chroot",
"clear",
# "coreutils_core",
Expand Down
18 changes: 18 additions & 0 deletions chmod/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "template" # Edit this
version = "0.1.0"
authors = ["Author <[email protected]>"] # Edit this
license = "MPL-2.0-no-copyleft-exception"
build = "build.rs"
edition = "2018"
description = """
Tool description
""" # Edit this

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "^2.33.0", features = ["wrap_help"] }

[build-dependencies]
clap = "^2.33.0"
24 changes: 24 additions & 0 deletions chmod/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use std::env;

use clap::Shell;

#[path = "src/cli.rs"]
mod cli;

fn main() {
let mut app = cli::create_app();

let out_dir = match env::var("OUT_DIR") {
Ok(dir) => dir,
Err(err) => {
eprintln!("No OUT_DIR: {}", err);
return;
},
};

app.gen_completions("chmod", Shell::Zsh, out_dir.clone());
app.gen_completions("chmod", Shell::Fish, out_dir.clone());
app.gen_completions("chmod", Shell::Bash, out_dir.clone());
app.gen_completions("chmod", Shell::PowerShell, out_dir.clone());
app.gen_completions("chmod", Shell::Elvish, out_dir);
}
15 changes: 15 additions & 0 deletions chmod/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use clap::{
crate_authors, crate_description, crate_name, crate_version, App, AppSettings::ColoredHelp, Arg,
};

pub(crate) fn create_app<'a, 'b>() -> App<'a, 'b> {
App::new(crate_name!())
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
.help_message("Display help information.")
.version_message("Display version information.")
.help_short("?")
.settings(&[ColoredHelp])
// Add args here
}
5 changes: 5 additions & 0 deletions chmod/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod cli;

fn main() {
let matches = cli::create_app().get_matches();
}