Skip to content

Commit

Permalink
📌 Update cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jascha030 committed Nov 27, 2022
1 parent a4c5c2a commit c725ef1
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 24 deletions.
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
[package]
name = "pmr"
description = "A small project management CLI utility, to store project management related links."
version = "0.1.0"
author = ["Jascha van Aalst"]
repository = "https://github.com/jascha030/pmr-rs"
homepage = "https://github.com/jascha030/pmr-rs"
edition = "2021"
license = "MIT"
license_file = "LICENSE"
keywords = ["CLI", "project", "management", "TOML"]
categories = ["command-line-utilities"]
readme = "README.md"

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

Expand Down
10 changes: 10 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MIT License

Copyright (c) 2022 Jascha van Aalst

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.

55 changes: 43 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,47 @@ The version mentioned above was originally intended as a prototype to be re-writ

***Up till now that is 🎉!***

<sub>
...Or Iguess up till almost that is 🎉!!
Because this version is currently still a work in progress.
</sub>

### Todo

* ~~Resource struct and open in browser logic~~ ✅
* ~~Config struct and toml parsing logic~~ ✅
* ~~Init command~~ ✅
* Open command 🚧
* Documentation 🚧
## Installation

```sh
cargo install pmr
```

## Commands

The CLI tool consists of two console commands.

### Init

Use the init command to create a `.pm.toml` resource file.

```sh
Usage: pmr init: [OPTIONS]

Options:
-h, --help Print help information
```

This will run you through a couple of questions asking if you want to add a project url for any of the following
categories:

* **Task Management**
* **Time tracking**
* **Git repo**

### Open

The open command provides quick access to your provided resources.

```sh
Usage: pmr open [OPTIONS]

Options:
-a, --all Open all resources
-h, --help Print help information
```

## License

This composer package is an open-sourced software licensed under the [MIT License](https://github.com/jascha030/pmr-rs/blob/master/LICENSE)

2 changes: 1 addition & 1 deletion src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod open;
#[clap(
name = "PMR",
author = "Jascha030 <[email protected]>",
version = "1.0",
version = "0.1.0",
about = "Manage Project Management Resources with a TOML file.",
long_about = None
)]
Expand Down
14 changes: 12 additions & 2 deletions src/command/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,24 @@ fn get_config() -> Result<Config, Error> {

Ok(config)
}
Err(e) => Err(e)
Err(e) => Err(e),
}
}

impl Run for Open {
fn run(&self) -> Result<(), Error> {
let all = self.all;

match get_config() {
Ok(config) => {
if all == true {
for res in config.list() {
res.open().unwrap();
}

return Ok(());
}

let selection = dialoguer::Select::new()
.items(&config.choices() as &[_])
.interact_on_opt(&Term::stderr())?;
Expand All @@ -55,7 +65,7 @@ impl Run for Open {
None => panic!("Something went wrong..."),
}
}
Err(e) => return Err(e)
Err(e) => return Err(e),
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl List for Config {

fn list(&self) -> Vec<&Resource> {
let mut list: Vec<&Resource> = vec![];

if self.tasks.is_some() {
list.push(self.tasks.as_ref().unwrap())
}
Expand Down
22 changes: 14 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ pub mod command;
pub mod config;
pub mod resource;

use crate::command::Run;
use crate::command::{Command, Run};
use clap::Parser;
use std::io::Result;
use std::panic;
use colored::Colorize;
use std::process::ExitCode;

use self::command::Command;

fn main() -> Result<()> {
fn main() -> ExitCode {
return match Command::parse().run() {
Ok(_) => Ok(()),
Err(e) => panic!("Something went wrong: {:?}", e),
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
eprintln!(
"{}",
format!("Pmr Error: {}", e.to_string().red().bold())
.to_string()
.red()
);
ExitCode::FAILURE
}
};
}

0 comments on commit c725ef1

Please sign in to comment.