Skip to content

Commit

Permalink
renamed all command to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
cqb13 committed May 17, 2024
1 parent fd6e374 commit 95fb12c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ jobs:
run: |
choco install zip
cd target/${{ matrix.target }}/release
zip gstats-0.1.1-${{ matrix.target }}.zip gstats.exe
zip gstats-0.1.2-${{ matrix.target }}.zip gstats.exe
cd ../../..
- name: Create tar.gz file on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
chmod +x target/${{ matrix.target }}/release/gstats
tar -zcf target/${{ matrix.target }}/release/gstats-0.1.1-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release gstats
tar -zcf target/${{ matrix.target }}/release/gstats-0.1.2-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release gstats
chmod +x target/${{ matrix.target2 }}/release/gstats
tar -zcf target/${{ matrix.target2 }}/release/gstats-0.1.1-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release gstats
tar -zcf target/${{ matrix.target2 }}/release/gstats-0.1.2-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release gstats
- name: Upload release and assets to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "release-0.1.1-${{ github.run_number }}"
release_name: gstats 0.1.1
tag: "release-0.1.2-${{ github.run_number }}"
release_name: gstats 0.1.2
file_glob: true
file: target/*/release/gstats-0.1.1-*.{zip,tar.gz}
file: target/*/release/gstats-0.1.2-*.{zip,tar.gz}
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "github-stats"
version = "0.1.0"
version = "0.1.2"
edition = "2021"
authors = ["cqb13 <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ COMMANDS:
Displays the current version of github-stats
install -
Installs the files and directories
all -
repo -
Gives all stats found on a repository as json
-u --user <USER> The user who owns the repository
-r --repository <REPOSITORY> Name of the repository
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod all;
pub mod relations;
pub mod releases;
pub mod repo;
pub mod user;
pub mod relations;
2 changes: 1 addition & 1 deletion src/commands/all.rs → src/commands/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::utils::{pretty_dates, request, write_to_file};
use serde_json::Value;
use std::path::PathBuf;

pub fn all_command(owner: String, repo: String, output: Option<PathBuf>, display: bool) {
pub fn repo_command(owner: String, repo: String, output: Option<PathBuf>, display: bool) {
let url = format!("https://api.github.com/repos/{}/{}", owner, repo);

let json = request(url).expect("Failed to request data");
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ pub mod commands;
pub mod utils;

use crate::cli::{Arg, Cli, Command};
use crate::commands::all::all_command;
use crate::commands::relations::{relations_command, RelationType};
use crate::commands::releases::releases_command;
use crate::commands::repo::repo_command;
use crate::commands::user::user_command;
use crate::utils::{install, validate_and_convert_path, OS};

fn main() {
let cli = Cli::new().with_default_command("help").with_commands(vec![
Command::new("version", "Displays the current version of github-stats").with_short('v'),
Command::new("install", "Installs the files and directories"),
Command::new("all", "Gives all stats found on a repository as json")
Command::new("repo", "Gives all stats found on a repository as json")
.with_arg(
Arg::new()
.with_name("user")
Expand Down Expand Up @@ -202,15 +202,15 @@ fn main() {

install(&os);
}
"all" => {
"repo" => {
let user = command.get_value_of("user").throw_if_none();
let repo = command.get_value_of("repository").throw_if_none();
let output = command.get_value_of("output").to_option();
let display = command.has("display");

let output = output_to_path(output);

all_command(user, repo, output, display);
repo_command(user, repo, output, display);
}
"releases" => {
let user = command.get_value_of("user").throw_if_none();
Expand Down

0 comments on commit 95fb12c

Please sign in to comment.