Skip to content

Commit

Permalink
Including Documentation (#5)
Browse files Browse the repository at this point in the history
* testing workflows

* updating change log

* including all documentation

Co-authored-by: @defstream <defstream@users.noreply.github.com>
  • Loading branch information
defstream and defstream authored Dec 22, 2022
1 parent 5e316f7 commit beb98f6
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .changes/v0.1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v0.1.2 - 2022-12-22
### Changed
* Additional build workflow updates - adding clippy
21 changes: 7 additions & 14 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@ on: [pull_request]
name: PULL

jobs:
check-changelog:
runs-on: ubuntu-20.04
steps:
- name: "Check for changelog entry"
uses: brettcannon/check-for-changed-files@v1.1.0
with:
file-pattern: |
.changes/unreleased/*.yaml
CHANGELOG.md
skip-label: "skip changelog"
failure-message: "Missing a changelog file in ${file-pattern}; please add one or apply the ${skip-label} label to the pull request"

build_and_test:
name: Kickable
pull:
name: kickable-pull-request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- uses: actions-rs/cargo@v1
with:
command: build
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
on: [release]

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: "validate changelog"
uses: brettcannon/check-for-changed-files@v1.1.0
with:
file-pattern: |
.changes/unreleased/*.yaml
CHANGELOG.md
skip-label: "skip changelog"
failure-message: "Missing a changelog file in ${file-pattern}; please add one or apply the ${skip-label} label to the pull request"
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## v0.1.2 - 2022-12-22
### Changed
* Additional build workflow updates - adding clippy

## v0.1.1 - 2022-12-22
### Changed
* Included Change request enforcement
Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

<p align="center">
<img src="https://media2.giphy.com/media/p3R62d6L0WYw0/200w.gif">
</p>

# kickable
**kickables** is a package created to answer the age old question... "_Can I Kick It?_"
_This package is for showcase purposes only._

**What is a kickable?**
Currently only the word "it" is kickable.

# Library

### Install

Download the binary from the releases page and place it in your path, or if you have cargo installed.
```shell
$ cargo install kickable@latest
```````

### Usage

```rust
use kickable;
fn main() {
let kickable = kickable::validate("it");
println!("Can I kick it? {kickable}");
}
```

# CLI

### Install

```bash
$ cargo install "kickable@latest"
```

### Usage

```shell
$ kickable "it"
```

# Maintainers
Hector Gray (Twitter: <a href="https://twitter.com/defstream">@defstream</a>)

# Contribute
Pull Requests welcome. Please make sure all tests pass 😀

# License
MIT
4 changes: 4 additions & 0 deletions examples/cargo-example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
let kickable = kickable::kickable::validate("it");
println!("Can I kick it? {kickable}");
}
19 changes: 14 additions & 5 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@

pub struct Args{
pub(crate) struct Args {
pub item: String,
}

pub fn parse() -> Args {
impl std::fmt::Display for Args {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let args: Vec<String> = std::env::args().collect();
write!(f, "{:?}", args)
}
}

pub(crate) fn parse() -> Args {
let input = std::env::args().nth(1).expect("invalid input");
return Args{item: input};
}

Args {
item: input,
}
}
18 changes: 14 additions & 4 deletions src/kickable.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@

pub fn validate(input :&str) -> bool {
/// Returns true if the input supplied is kickable.
///
/// # Arguments
///
/// * `input` - A string to validate for kick-ability.
///
/// # Examples
///
#[allow(rustdoc::bare_urls)]
#[cfg_attr(not(feature = "derive"), doc = " ```ignore")]
#[doc = include_str!("../examples/cargo-example.rs")]
pub fn validate(input: &str) -> bool {
if input.to_lowercase() == "it" {
return true;
}
return false;
}
false
}
19 changes: 19 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed under the MIT license
// (see LICENSE or <http://opensource.org/licenses/MIT>) All files in the project carrying such
// notice may not be copied, modified, or distributed except according to those terms.

//! > **kickable** is a package created to answer the age old question... "_Can I Kick It?_"
//!
//! Quick Links:
//! - Can I Kick It [music video](https://www.youtube.com/watch?v=O3pyCGnZzYA)
//! ## Example
//!
//! Run
//! ```console
//! $ cargo add kickable
//! ```
//! Then use kickable in your code`:
#![cfg_attr(not(feature = "derive"), doc = " ```ignore")]
#![cfg_attr(feature = "derive", doc = " ```no_run")]
#![doc = include_str!("../examples/cargo-example.rs")]
pub mod kickable;
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
mod args;
mod kickable;

const NO: &'static str = "No.";
const YES: &'static str = "Yes, yes you can.";
const NO_INPUT: &'static str = "\n👟Kickable let's you know if you can kick it.\n\nUsage: {kickable} <item>\n<item> is the value to check for kick-ability.";
const NO: &str = "No.";
const YES: &str = "Yes, yes you can.";
const NO_INPUT: &str = "\n👟Kickable let's you know if you can kick it.\n\nUsage: {kickable} <item>\n<item> is the value to check for kick-ability.";

fn main() {
// 1. validate input
if std::env::args().len() == 1 {
println!("{NO_INPUT}");
std::process::exit(exitcode::NOINPUT);
}

// 2. parse input
let args = args::parse();

// 3. validate inputs kick-ability
if kickable::validate(&args.item) {
println!("{YES}");
std::process::exit(exitcode::OK);
Expand Down

0 comments on commit beb98f6

Please sign in to comment.