stub
This commit is contained in:
parent
a52bd65ee9
commit
131dc3e0e3
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,4 +0,0 @@
|
||||
[submodule "tests"]
|
||||
path = tests
|
||||
url = https://github.com/RXT0113/HELL.git
|
||||
branch = master
|
@ -8,6 +8,11 @@ version = "0.0.0"
|
||||
authors = ["Kreyren <KostWarCZE@RiXotStudio.cz>"]
|
||||
edition = "2018"
|
||||
|
||||
# FIXME: Implement automation that bumps the dependencies in a new commit to make it easier to track dependency-caused issues
|
||||
[dependencies]
|
||||
# FIXME: Replace with latest once development is done
|
||||
clap = "2.30.0"
|
||||
# FIXME: Replace with latest once development is in gold
|
||||
clap = "2.33.0"
|
||||
# FIXME: Replace with latest once development is in gold
|
||||
log = "0.4.8"
|
||||
# FIXME: Replace with latest once development is in gold
|
||||
die = "0.2.0"
|
@ -1,65 +0,0 @@
|
||||
// (Full example with detailed comments in examples/01b_quick_example.rs)
|
||||
//
|
||||
// This example demonstrates clap's full 'builder pattern' style of creating arguments which is
|
||||
// more verbose, but allows easier editing, and at times more advanced options, or the possibility
|
||||
// to generate arguments dynamically.
|
||||
extern crate clap;
|
||||
use clap::{Arg, App, SubCommand};
|
||||
|
||||
fn main() {
|
||||
let matches = App::new("My Super Program")
|
||||
.version("1.0")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.about("Does awesome things")
|
||||
.arg(Arg::with_name("config")
|
||||
.short("c")
|
||||
.long("config")
|
||||
.value_name("FILE")
|
||||
.help("Sets a custom config file")
|
||||
.takes_value(true))
|
||||
.arg(Arg::with_name("INPUT")
|
||||
.help("Sets the input file to use")
|
||||
.required(true)
|
||||
.index(1))
|
||||
.arg(Arg::with_name("v")
|
||||
.short("v")
|
||||
.multiple(true)
|
||||
.help("Sets the level of verbosity"))
|
||||
.subcommand(SubCommand::with_name("test")
|
||||
.about("controls testing features")
|
||||
.version("1.3")
|
||||
.author("Someone E. <someone_else@other.com>")
|
||||
.arg(Arg::with_name("debug")
|
||||
.short("d")
|
||||
.help("print debug information verbosely")))
|
||||
.get_matches();
|
||||
|
||||
// Gets a value for config if supplied by user, or defaults to "default.conf"
|
||||
let config = matches.value_of("config").unwrap_or("default.conf");
|
||||
println!("Value for config: {}", config);
|
||||
|
||||
// Calling .unwrap() is safe here because "INPUT" is required (if "INPUT" wasn't
|
||||
// required we could have used an 'if let' to conditionally get the value)
|
||||
println!("Using input file: {}", matches.value_of("INPUT").unwrap());
|
||||
|
||||
// Vary the output based on how many times the user used the "verbose" flag
|
||||
// (i.e. 'myprog -v -v -v' or 'myprog -vvv' vs 'myprog -v'
|
||||
match matches.occurrences_of("v") {
|
||||
0 => println!("No verbose info"),
|
||||
1 => println!("Some verbose info"),
|
||||
2 => println!("Tons of verbose info"),
|
||||
3 | _ => println!("Don't be crazy"),
|
||||
}
|
||||
|
||||
// You can handle information about subcommands by requesting their matches by name
|
||||
// (as below), requesting just the name used, or both at the same time
|
||||
if let Some(matches) = matches.subcommand_matches("test") {
|
||||
if matches.is_present("debug") {
|
||||
println!("Printing debug info...");
|
||||
} else {
|
||||
println!("Printing normally...");
|
||||
}
|
||||
}
|
||||
|
||||
// more program logic goes here...
|
||||
}
|
@ -4,22 +4,104 @@
|
||||
extern crate clap;
|
||||
use clap::{Arg, App, SubCommand};
|
||||
|
||||
extern crate kreypi;
|
||||
// Get die macro
|
||||
/// FIXME: Contribute in die crate to allow customization of messages by the end-user
|
||||
use die::die;
|
||||
|
||||
// Macro to handle fixme messages
|
||||
/// FIXME: Implement export in log directory based on system used
|
||||
/// FIXME: Outsource parts of the code in log crate?
|
||||
/// FIXME: Allow end-user to customize the message
|
||||
/// FIXME: Allow end-user to mute the messages through configuration
|
||||
/// FIXME: Contribute in log to outsource maintainance on them
|
||||
macro_rules! fixme {
|
||||
($msg:expr) => ( println!("FIXME: {}", $msg);)
|
||||
}
|
||||
|
||||
// Macro to overwrite default `unimplemented!();` to be more user-friendly
|
||||
// FIXME: Determine error code for unimplemented
|
||||
macro_rules! unimplemented {
|
||||
($msg:expr) => (
|
||||
die!(126; "UNIMPLEMENTED: {}", $msg);
|
||||
)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fixme!("Add method to handle translations");
|
||||
fixme!("Returns 0 even when no argument was parsed -> Expecting Exit 2 with help message");
|
||||
fixme!("Allow changing name based on config file");
|
||||
|
||||
// Capture arguments (https://docs.rs/clap/2.33.0/clap/)
|
||||
// FIXME: Check if structOpt (https://docs.rs/structopt/0.3.7/structopt/#subcommands) is not better for our usecase
|
||||
// FIXME-TEST: Add test to make sure that clap works the way we want it
|
||||
let matches = App::new("RXT0112")
|
||||
.version("0.0.0")
|
||||
.version("INIT_PHASE_VERSION") // Replace with valid versioning
|
||||
.author("Jacob Hrbek <kreyren@rixotstudio.cz>")
|
||||
.about("Work in progress package manager")
|
||||
.about("Work in progress package manager expected to support any kernel on any downstream")
|
||||
.arg(Arg::with_name("gui")
|
||||
.short("G")
|
||||
.long("gui")
|
||||
.multiple(true)
|
||||
.help("Opens up a Graphical User Interface frontend"))
|
||||
// FIXME-QA: Sort subcommands alphabetically
|
||||
.subcommand(SubCommand::with_name("resolve")
|
||||
.about("Resolved package to be imported in the system")
|
||||
.arg_from_usage("<category/package> 'Package identifier'"))
|
||||
.subcommand(SubCommand::with_name("remove")
|
||||
.about("Remove package from the system")
|
||||
.arg_from_usage("-r, remove 'Removing of packages'"))
|
||||
.subcommand(SubCommand::with_name("list")
|
||||
.about("Listing of packages")
|
||||
.arg_from_usage("-l, list 'Listing of packages'"))
|
||||
.subcommand(SubCommand::with_name("deploy")
|
||||
.about("deploy (WIP-NAME) on target used for initial instalation")
|
||||
.arg_from_usage("-l, list 'Listing of packages'"))
|
||||
// FIXME: Replace with following: .arg_from_usage("deploy 'Deploy (WIP-NAME) on target which creates required file hierarchy and configuration needed for (WIP-NAME)'"))
|
||||
.subcommand(SubCommand::with_name("hijack")
|
||||
.about("Import (WIP-NAME) on target system that already exists for (WIP-NAME) to be used as alternative package manager")
|
||||
.arg_from_usage("-l, list 'Listing of packages'"))
|
||||
// FIXME: Replace with following: .arg_from_usage("hijack 'Import (WIP-NAME) on target system that already exists for (WIP-NAME) to be used as alternative package manager'"))
|
||||
.get_matches();
|
||||
|
||||
if let Some(matches) = matches.subcommand_matches("resolve") {
|
||||
efixme("Add abstract");
|
||||
} else { // To be adapted for additional arguments
|
||||
println!("pong");
|
||||
// Manage arguments
|
||||
// NOTICE: Do not add else statement to catch unexpecteds since this is handled by clap
|
||||
if matches.is_present("gui") {
|
||||
unimplemented!("GUI method is not yet implemented");
|
||||
}
|
||||
|
||||
// Manage subcommands
|
||||
// NOTICE: Do not add else statement to catch unexpecteds since this is handled by clap
|
||||
// FIXME: Convert this statement in case which would seem like better implementation
|
||||
if let Some(_matches) = matches.subcommand_matches("resolve") {
|
||||
// Current approach: Download source to
|
||||
fixme!("Check if expected file hierarchy is present, if not prompt for init subcommand");
|
||||
fixme!("Initiate sandbox");
|
||||
fixme!("Allow multiple methods of sandboxing");
|
||||
fixme!("Fetch source");
|
||||
fixme!("Cache source");
|
||||
fixme!("Configure source");
|
||||
fixme!("Compile source");
|
||||
fixme!("Install source");
|
||||
fixme!("Add a method to customize the resolution by the end-user");
|
||||
// FIXME: Outputs user-unfriendly message
|
||||
unimplemented!("Resolving of packages is not yet implemented");
|
||||
} else if let Some(_matches) = matches.subcommand_matches("list") {
|
||||
fixme!("Output installed packages");
|
||||
unimplemented!("Listing is not yet implemented");
|
||||
} else if let Some(_matches) = matches.subcommand_matches("deploy") {
|
||||
// ABSTRACT: This is expected to be the installation method for the end-users to get OS with (WIP-NAME)
|
||||
fixme!("Deploy on target");
|
||||
fixme!("Deploy based on ENV variable");
|
||||
fixme!("Deploy based on config file");
|
||||
fixme!("Allow selection of file system hierarchy from CLI args");
|
||||
fixme!("Deploy kernel based on CLI args");
|
||||
fixme!("Deploy toolchain based on CLI args");
|
||||
fixme!("Deploy features");
|
||||
fixme!("Expected feature: Kreyrock");
|
||||
fixme!("Expected feature: winehq for unix");
|
||||
unimplemented!("Listing is not yet implemented");
|
||||
} else if let Some(_matches) = matches.subcommand_matches("remove") {
|
||||
fixme!("Remove package from specified root");
|
||||
unimplemented!("Removal of packages from specified root is not yet supported");
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
// Library used for cli argument management
|
||||
use clap::{Arg, App, SubCommand};
|
||||
|
||||
// Export functions for output handling
|
||||
// FIXME: Export in a crate once development is finished
|
||||
pub mod output { pub mod efixme; }
|
||||
use log::{info, trace, warn};
|
@ -1,14 +0,0 @@
|
||||
// Created by Jacob Hrbek <kreyren@rixotstudio.cz> under GPL-3 license (https://www.gnu.org/licenses/gpl-3.0.en.html) in 2020
|
||||
|
||||
/*
|
||||
Output FIXME message for features that needs implementation
|
||||
|
||||
SYNOPSIS: efixme [message]
|
||||
*/
|
||||
|
||||
// FIXME: Allow 'FIXME:' prefix to be configurable from 'EFIXME_PREFIX' env variable
|
||||
|
||||
pub fn efixme<S: AsRef<str>>(stringlike: S) {
|
||||
let str_ref = stringlike.as_ref();
|
||||
println!("FIXME: {:?}", str_ref)
|
||||
}
|
1
tests
1
tests
@ -1 +0,0 @@
|
||||
Subproject commit 0d61fd425bfd34cb6c8428e08449db8453ae51eb
|
Loading…
Reference in New Issue
Block a user