Skip to content

Commit

Permalink
More boilerplace things
Browse files Browse the repository at this point in the history
  • Loading branch information
Stridsvagn69420 committed Jun 25, 2023
1 parent 0e4ddcd commit 7e498f2
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
# Rust
/target
151 changes: 151 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[package]
name = "rmdup"
description = "Simple tool for removing duplicate files"
version = "0.1.0"
edition = "2021"
authors = ["Stridsvagn69420 (https://github.com/Stridsvagn69420)"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/Stridsvagn69420/rmdup"
documentation = "https://github.com/Stridsvagn69420/rmdup"
categories = ["command-line-utilities", "filesystem"]
keywords = ["coreutils", "command-line", "duplicate"]

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

[dependencies]
blake3 = "1.4"
blake3 = "1.4"
kagero = { version = "0.4", default-features = false, features = ["printer"] }
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Stridsvagn69420

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions src/help.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use kagero::printer::{Colors, Printer};

/// Help Message
///
/// Displays a help message for using this tool.
pub(crate) fn help_message(p: &mut Printer) {
p.writeln("Help Message still WIP");
}

/// Version Message
///
/// Prints metadata like authors and version of the program.
pub(crate) fn version(p: &mut Printer) {
p.writeln("Version Message still WIP");
}
29 changes: 27 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
fn main() {
println!("Hello, world!");
use std::env;
use std::process::ExitCode;
use kagero::printer::Printer;
mod help;

fn main() -> ExitCode {
let mut prnt = Printer::default();
let args: Vec<String> = env::args().collect();

// Get file via command-line arguments
let Some(file) = args.get(1) else {
help::help_message(&mut prnt);
return ExitCode::FAILURE;
};

// Flag handle
return match file.as_str() {
"-h" | "--help" => {
help::help_message(&mut prnt);
ExitCode::SUCCESS
},
"-V" | "--version" => {
help::version(&mut prnt);
ExitCode::SUCCESS
},
_ => ExitCode::SUCCESS // TODO: Replace this with function call that does the acutal logic.
}
}

0 comments on commit 7e498f2

Please sign in to comment.