stub
This commit is contained in:
parent
6d9ece6f06
commit
77a876481b
@ -1,7 +1,7 @@
|
||||
# Reference https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[package]
|
||||
name = "RXT0112"
|
||||
name = "zernif"
|
||||
description = "FIXME: description needed"
|
||||
keywords = ["package-manager"]
|
||||
version = "0.0.0"
|
||||
|
@ -1,11 +1,11 @@
|
||||
This license is now voided untill finished into a production to replace current license by which it's meant to be announced the change by the original creator of this project (github.com/kreyren)
|
||||
This license is now voided until finished into a production to replace current license by which it's meant to be announced the change by the original creator of this project (github.com/kreyren)
|
||||
|
||||
---
|
||||
|
||||
# RXT GENERAL LICENSE (RXT-G0)
|
||||
Version 0, 20 January 2020
|
||||
|
||||
Copyright (C) 2020 [RiXotStudio](http://rixotstudio.cz) and contributors
|
||||
Copyright (C) 2020 [RiXotStudio](http://rixotstudio.cz)
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
1
src/bin/README.md
Normal file
1
src/bin/README.md
Normal file
@ -0,0 +1 @@
|
||||
This directory is used for various subcommands used by zernif
|
@ -1,114 +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
|
||||
|
||||
// Source lib.rs
|
||||
// FIXME-QA: Is this the best way to do this?
|
||||
use RXT0112::*;
|
||||
|
||||
fn main() {
|
||||
die!(1; "ping");
|
||||
fixme!("Add method to handle translations");
|
||||
fixme!("Allow changing name based on config file");
|
||||
fixme!("Verify that this works on POSIX");
|
||||
|
||||
// Capture arguments (https://docs.rs/clap/2.33.0/clap/)
|
||||
// FIXME-BENCHMARK: Benchmark other option like structOpt (https://docs.rs/structopt/0.3.7/structopt/#subcommands)
|
||||
// FIXME-TEST: Add test to make sure that clap works the way we want it
|
||||
let matches = App::new("RXT0112")
|
||||
.version("INIT_PHASE_VERSION") // Replace with valid versioning
|
||||
.author("Jacob Hrbek <kreyren@rixotstudio.cz>")
|
||||
.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"))
|
||||
.arg(Arg::with_name("dev")
|
||||
.short("D")
|
||||
.long("development")
|
||||
.multiple(true)
|
||||
.help("Perform all following actions in a temporary sandboxed directory used for development"))
|
||||
// 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();
|
||||
|
||||
// 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");
|
||||
} else if matches.is_present("dev") {
|
||||
// WARNING: Has to be implemented prior to implementing other features
|
||||
// FIXME-TEST: Make a test to ensure that features are not escaping sandbox
|
||||
// FIXME: Translate in rustlang from english
|
||||
fixme!("Create a new directory in tmpdir/name-of-project");
|
||||
emkdir("/var/tmp/RXT0112");
|
||||
fixme!("Create sandboxed environment for testing of features");
|
||||
unimplemented!("Development method is not yet supported");
|
||||
}
|
||||
|
||||
// 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("deploy") {
|
||||
fixme!("Perform sanity-checks for hijacking");
|
||||
fixme!("Hijack apt");
|
||||
fixme!("Hijack pacman");
|
||||
fixme!("Hijack portage");
|
||||
fixme!("Hijack dnf");
|
||||
fixme!("Hijack zypper");
|
||||
fixme!("Hijack freebsd pckm");
|
||||
fixme!("Hijack MacOS");
|
||||
fixme!("Hijack Windows?");
|
||||
fixme!("Die if untested system is parsed");
|
||||
fixme!("Die if used on invalid directory (suggest deploy instead?)");
|
||||
unimplemented!("Hijacking is not yet supported");
|
||||
} 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");
|
||||
}
|
||||
|
||||
fixme!("Returns 0 even when no argument was parsed -> Expecting Exit 2 with help message");
|
||||
}
|
3
src/bin/resolve.rs
Normal file
3
src/bin/resolve.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
unimplemented!("Package resolution is not yet implemented");
|
||||
}
|
@ -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...
|
||||
}
|
29
src/lib.rs
29
src/lib.rs
@ -2,30 +2,5 @@
|
||||
File used for sourcing of libraries
|
||||
*/
|
||||
|
||||
// FIXME: Optimize dependencies depending on what is being called and used
|
||||
|
||||
// FIXME: Resolve once name of the project is determined
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
// Library used for cli argument management
|
||||
extern crate clap;
|
||||
pub use clap::{Arg, App, SubCommand};
|
||||
|
||||
// Export for metadata?
|
||||
// FIXME: Verify unused
|
||||
pub use std::fs;
|
||||
|
||||
// Export of standard library to make a new directory (works cross-platform)
|
||||
// FIXME: Make create_dir to output TRACE message of level 2
|
||||
// FIXME: Output helpful error in CLI and logs
|
||||
pub use std::fs::create_dir;
|
||||
|
||||
// Get die macro
|
||||
// FIXME: Contribute in die crate to allow customization of messages by the end-user
|
||||
pub use die::die;
|
||||
|
||||
// Required for create_dir
|
||||
pub use std::fs::metadata;
|
||||
|
||||
// Required for emkdir
|
||||
pub use std::io;
|
||||
// Use modules
|
||||
pub mod modules;
|
@ -1,55 +1,12 @@
|
||||
// Created by Jacob Hrbek <kreyren@rixotstudio.cz> under GPL-3 license (https://www.gnu.org/licenses/gpl-3.0.en.html) in 2020
|
||||
|
||||
// THIS IS TEMPORARY FILE -> Expecting to outsource all commains in `src/bin`
|
||||
|
||||
// Source lib.rs
|
||||
// FIXME-QA: Is this the best way to do this?
|
||||
use RXT0112::*;
|
||||
|
||||
// FIXME: Move macros for output in their standalone crate
|
||||
|
||||
// Macro to handle fixme messages
|
||||
// FIXME: Implement export in log directory based on system used
|
||||
// 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 inform the end-user about non-fatal error
|
||||
// FIXME: Implement export in log directory based on system used
|
||||
// FIXME: Allow end-user to customize the message
|
||||
// FIXME: Contribute in log to outsource maintainance on them
|
||||
macro_rules! error {
|
||||
($msg:expr) => ( println!("ERROR: {}", $msg);)
|
||||
}
|
||||
|
||||
// Macro to perform tracing
|
||||
// FIXME: Implement export in log directory based on system used and debug level
|
||||
// FIXME: Allow end-user to customize the message
|
||||
// FIXME: Contribute in log to outsource maintainance on them
|
||||
// FIXME: Output only if debug level 2 and higger is used
|
||||
macro_rules! trace {
|
||||
($msg:expr) => ( println!("TRACE: {}", $msg);)
|
||||
}
|
||||
|
||||
// Macro to handle info 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
|
||||
macro_rules! info {
|
||||
($msg:expr) => ( println!("INFO: {}", $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);
|
||||
)
|
||||
}
|
||||
use zernif::fixme;
|
||||
|
||||
fn main() {
|
||||
die!(1; "ping");
|
||||
fixme!("Add method to handle translations");
|
||||
fixme!("Allow changing name based on config file");
|
||||
fixme!("Verify that this works on POSIX");
|
||||
@ -57,6 +14,8 @@ fn main() {
|
||||
// Capture arguments (https://docs.rs/clap/2.33.0/clap/)
|
||||
// FIXME-BENCHMARK: Benchmark other option like structOpt (https://docs.rs/structopt/0.3.7/structopt/#subcommands)
|
||||
// FIXME-TEST: Add test to make sure that clap works the way we want it
|
||||
use clap::{Arg, App, SubCommand};
|
||||
|
||||
let matches = App::new("RXT0112")
|
||||
.version("INIT_PHASE_VERSION") // Replace with valid versioning
|
||||
.author("Jacob Hrbek <kreyren@rixotstudio.cz>")
|
||||
@ -100,7 +59,7 @@ fn main() {
|
||||
// FIXME-TEST: Make a test to ensure that features are not escaping sandbox
|
||||
// FIXME: Translate in rustlang from english
|
||||
fixme!("Create a new directory in tmpdir/name-of-project");
|
||||
emkdir("/var/tmp/RXT0112");
|
||||
//emkdir("$TEMPDIR/RXT0112");
|
||||
fixme!("Create sandboxed environment for testing of features");
|
||||
unimplemented!("Development method is not yet supported");
|
||||
}
|
1
src/modules/README.md
Normal file
1
src/modules/README.md
Normal file
@ -0,0 +1 @@
|
||||
This is non-standard file hierarchy used for code blocks that are used in binaries
|
1
src/modules/mod.rs
Normal file
1
src/modules/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod output;
|
@ -7,6 +7,7 @@
|
||||
// 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_export]
|
||||
macro_rules! fixme {
|
||||
($msg:expr) => ( println!("FIXME: {}", $msg);)
|
||||
}
|
||||
@ -15,6 +16,7 @@ macro_rules! fixme {
|
||||
// FIXME: Implement export in log directory based on system used
|
||||
// FIXME: Allow end-user to customize the message
|
||||
// FIXME: Contribute in log to outsource maintainance on them
|
||||
#[macro_export]
|
||||
macro_rules! error {
|
||||
($msg:expr) => ( println!("ERROR: {}", $msg);)
|
||||
}
|
||||
@ -24,22 +26,26 @@ macro_rules! error {
|
||||
// FIXME: Allow end-user to customize the message
|
||||
// FIXME: Contribute in log to outsource maintainance on them
|
||||
// FIXME: Output only if debug level 2 and higger is used
|
||||
#[macro_export]
|
||||
macro_rules! trace {
|
||||
($msg:expr) => ( println!("TRACE: {}", $msg);)
|
||||
}
|
||||
|
||||
// Macro to handle info 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: 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
|
||||
#[macro_export]
|
||||
macro_rules! info {
|
||||
($msg:expr) => ( println!("INFO: {}", $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);
|
||||
)
|
||||
}
|
||||
// FIXME: Cargo complains about us overwriting unimplemented()
|
||||
// #[macro_export]
|
||||
// macro_rules! unimplemented {
|
||||
// ($msg:expr) => (
|
||||
// die!(126; "UNIMPLEMENTED: {}", $msg);
|
||||
// )
|
||||
// }
|
Loading…
Reference in New Issue
Block a user