Skip to content

Commit 3a3242a

Browse files
committed
imrpoved cli
2 parents 6532433 + 95fb12c commit 3a3242a

6 files changed

Lines changed: 251 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ jobs:
5252
run: |
5353
choco install zip
5454
cd target/${{ matrix.target }}/release
55-
zip gstats-0.1.1-${{ matrix.target }}.zip gstats.exe
55+
zip gstats-0.1.2-${{ matrix.target }}.zip gstats.exe
5656
cd ../../..
5757
5858
- name: Create tar.gz file on macOS
5959
if: ${{ matrix.os == 'macos-latest' }}
6060
run: |
6161
chmod +x target/${{ matrix.target }}/release/gstats
62-
tar -zcf target/${{ matrix.target }}/release/gstats-0.1.1-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release gstats
62+
tar -zcf target/${{ matrix.target }}/release/gstats-0.1.2-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release gstats
6363
chmod +x target/${{ matrix.target2 }}/release/gstats
64-
tar -zcf target/${{ matrix.target2 }}/release/gstats-0.1.1-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release gstats
64+
tar -zcf target/${{ matrix.target2 }}/release/gstats-0.1.2-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release gstats
6565
6666
- name: Upload release and assets to GitHub
6767
uses: svenstaro/upload-release-action@v2
6868
with:
6969
repo_token: ${{ secrets.GITHUB_TOKEN }}
70-
tag: "release-0.1.1-${{ github.run_number }}"
71-
release_name: gstats 0.1.1
70+
tag: "release-0.1.2-${{ github.run_number }}"
71+
release_name: gstats 0.1.2
7272
file_glob: true
73-
file: target/*/release/gstats-0.1.1-*.{zip,tar.gz}
73+
file: target/*/release/gstats-0.1.2-*.{zip,tar.gz}

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[package]
22
name = "github-stats"
3+
<<<<<<< HEAD
34
version = "0.1.1"
5+
=======
6+
version = "0.1.2"
7+
>>>>>>> refs/remotes/origin/main
48
edition = "2021"
59
authors = ["cqb13 <cqb13.dev@gmail.com>"]
610
license = "MIT"

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ USAGE:
5050
gstats [COMMAND] [OPTIONS]
5151

5252
COMMANDS:
53+
<<<<<<< HEAD
5354
help - Prints help information
5455
command <COMMAND> (optional) The command you want help with
5556

@@ -94,6 +95,45 @@ COMMANDS:
9495
-t --toal Displays the total follower count
9596
-o --output <OUTPUT> File path to save the json
9697
-d --display Converts the json to an easier format (will remove some data)
98+
=======
99+
version -v
100+
Displays the current version of github-stats
101+
install -
102+
Installs the files and directories
103+
repo -
104+
Gives all stats found on a repository as json
105+
-u --user <USER> The user who owns the repository
106+
-r --repository <REPOSITORY> Name of the repository
107+
-o --output <OUTPUT> File path to save the json
108+
-d --display <> Converts the json to an easier format (will remove some data)
109+
releases -
110+
Gives information on github releases
111+
-u --user <USER> The user who owns the repository
112+
-r --repository <REPOSITORY> Name of the repository
113+
-i --individual <> Downloads per release
114+
-l --link <> Download links for releases (if not individual then for latest)
115+
-o --output <OUTPUT> File path to save the json
116+
-a --all <> All json from request
117+
-d --display <> Converts the json to an easier format (will remove some data)
118+
user -
119+
Gives information about a github user
120+
-u --user <USER> The user you want information on
121+
-o --output <OUTPUT> File path to save the json
122+
-d --display <> Converts the json to an easier format (will remove some data)
123+
followers -
124+
Lists the followers of a github user
125+
-u --user <USER> The user you want information on
126+
-t --total <TOTAL> Gives the follower count
127+
-o --output <OUTPUT> File path to save the json
128+
-d --display <> Converts the json to an easier format (will remove some data)
129+
following -
130+
Lists users the user is following
131+
-u --user <USER> The user you want information on
132+
-t --total <TOTAL> Gives the following count
133+
-o --output <OUTPUT> File path to save the json
134+
-d --display <> Converts the json to an easier format (will remove some data)
135+
help -h
136+
>>>>>>> refs/remotes/origin/main
97137
```
98138

99139
## Contributing

src/commands/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
<<<<<<< HEAD
12
pub mod repo;
23
pub mod releases;
34
pub mod user;
5+
=======
6+
>>>>>>> refs/remotes/origin/main
47
pub mod relations;
8+
pub mod releases;
9+
pub mod repo;
10+
pub mod user;

src/main.rs

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ pub mod commands;
33
pub mod styles;
44
pub mod utils;
55

6+
<<<<<<< HEAD
67
use crate::cli::{Arg, Cli, CmdOption, Command};
8+
=======
9+
use crate::cli::{Arg, Cli, Command};
10+
>>>>>>> refs/remotes/origin/main
711
use crate::commands::relations::{relations_command, RelationType};
812
use crate::commands::releases::releases_command;
913
use crate::commands::repo::repo_command;
1014
use crate::commands::user::user_command;
1115
use crate::utils::{install, validate_and_convert_path, OS};
1216

1317
fn main() {
18+
<<<<<<< HEAD
1419
let cli = Cli::new()
1520
.with_command(Command::new("help", "Prints help information").with_option(
1621
CmdOption::new("command", "COMMAND", "The command you want help with").optional(),
@@ -173,6 +178,186 @@ fn main() {
173178
'd',
174179
)),
175180
);
181+
=======
182+
let cli = Cli::new().with_default_command("help").with_commands(vec![
183+
Command::new("version", "Displays the current version of github-stats").with_short('v'),
184+
Command::new("install", "Installs the files and directories"),
185+
Command::new("repo", "Gives all stats found on a repository as json")
186+
.with_arg(
187+
Arg::new()
188+
.with_name("user")
189+
.with_short('u')
190+
.with_long("user")
191+
.with_value_name("USER")
192+
.with_help("The user who owns the repository"),
193+
)
194+
.with_arg(
195+
Arg::new()
196+
.with_name("repository")
197+
.with_short('r')
198+
.with_long("repository")
199+
.with_value_name("REPOSITORY")
200+
.with_help("Name of the repository"),
201+
)
202+
.with_arg(
203+
Arg::new()
204+
.with_name("output")
205+
.with_short('o')
206+
.with_long("output")
207+
.with_value_name("OUTPUT")
208+
.with_help("File path to save the json"),
209+
)
210+
.with_arg(
211+
Arg::new()
212+
.with_name("display")
213+
.with_short('d')
214+
.with_long("display")
215+
.with_help("Converts the json to an easier format (will remove some data)"),
216+
),
217+
Command::new("releases", "Gives information on github releases")
218+
.with_arg(
219+
Arg::new()
220+
.with_name("user")
221+
.with_short('u')
222+
.with_long("user")
223+
.with_value_name("USER")
224+
.with_help("The user who owns the repository"),
225+
)
226+
.with_arg(
227+
Arg::new()
228+
.with_name("repository")
229+
.with_short('r')
230+
.with_long("repository")
231+
.with_value_name("REPOSITORY")
232+
.with_help("Name of the repository"),
233+
)
234+
.with_arg(
235+
Arg::new()
236+
.with_name("individual")
237+
.with_short('i')
238+
.with_long("individual")
239+
.with_help("Downloads per release"),
240+
)
241+
.with_arg(
242+
Arg::new()
243+
.with_name("link")
244+
.with_short('l')
245+
.with_long("link")
246+
.with_help("Download links for releases (if not individual then for latest)"),
247+
)
248+
.with_arg(
249+
Arg::new()
250+
.with_name("output")
251+
.with_short('o')
252+
.with_long("output")
253+
.with_value_name("OUTPUT")
254+
.with_help("File path to save the json"),
255+
)
256+
.with_arg(
257+
Arg::new()
258+
.with_name("all")
259+
.with_short('a')
260+
.with_long("all")
261+
.with_help("All json from request"),
262+
)
263+
.with_arg(
264+
Arg::new()
265+
.with_name("display")
266+
.with_short('d')
267+
.with_long("display")
268+
.with_help("Converts the json to an easier format (will remove some data)"),
269+
),
270+
Command::new("user", "Gives information about a github user")
271+
.with_arg(
272+
Arg::new()
273+
.with_name("user")
274+
.with_short('u')
275+
.with_long("user")
276+
.with_value_name("USER")
277+
.with_help("The user you want information on"),
278+
)
279+
.with_arg(
280+
Arg::new()
281+
.with_name("output")
282+
.with_short('o')
283+
.with_long("output")
284+
.with_value_name("OUTPUT")
285+
.with_help("File path to save the json"),
286+
)
287+
.with_arg(
288+
Arg::new()
289+
.with_name("display")
290+
.with_short('d')
291+
.with_long("display")
292+
.with_help("Converts the json to an easier format (will remove some data)"),
293+
),
294+
Command::new("followers", "Lists the followers of a github user")
295+
.with_arg(
296+
Arg::new()
297+
.with_name("user")
298+
.with_short('u')
299+
.with_long("user")
300+
.with_value_name("USER")
301+
.with_help("The user you want information on"),
302+
)
303+
.with_arg(
304+
Arg::new()
305+
.with_name("total")
306+
.with_short('t')
307+
.with_long("total")
308+
.with_value_name("TOTAL")
309+
.with_help("Gives the follower count"),
310+
)
311+
.with_arg(
312+
Arg::new()
313+
.with_name("output")
314+
.with_short('o')
315+
.with_long("output")
316+
.with_value_name("OUTPUT")
317+
.with_help("File path to save the json"),
318+
)
319+
.with_arg(
320+
Arg::new()
321+
.with_name("display")
322+
.with_short('d')
323+
.with_long("display")
324+
.with_help("Converts the json to an easier format (will remove some data)"),
325+
),
326+
Command::new("following", "Lists users the user is following")
327+
.with_arg(
328+
Arg::new()
329+
.with_name("user")
330+
.with_short('u')
331+
.with_long("user")
332+
.with_value_name("USER")
333+
.with_help("The user you want information on"),
334+
)
335+
.with_arg(
336+
Arg::new()
337+
.with_name("total")
338+
.with_short('t')
339+
.with_long("total")
340+
.with_value_name("TOTAL")
341+
.with_help("Gives the following count"),
342+
)
343+
.with_arg(
344+
Arg::new()
345+
.with_name("output")
346+
.with_short('o')
347+
.with_long("output")
348+
.with_value_name("OUTPUT")
349+
.with_help("File path to save the json"),
350+
)
351+
.with_arg(
352+
Arg::new()
353+
.with_name("display")
354+
.with_short('d')
355+
.with_long("display")
356+
.with_help("Converts the json to an easier format (will remove some data)"),
357+
),
358+
Command::new("help", "Helps you with the commands").with_short('h'),
359+
]);
360+
>>>>>>> refs/remotes/origin/main
176361

177362
let command = cli.match_commands();
178363

@@ -188,9 +373,15 @@ fn main() {
188373
install(&os);
189374
}
190375
"repo" => {
376+
<<<<<<< HEAD
191377
let user = command.get_option("user").throw_if_none();
192378
let repo = command.get_option("repository").throw_if_none();
193379
let output = command.get_arg("output").to_option();
380+
=======
381+
let user = command.get_value_of("user").throw_if_none();
382+
let repo = command.get_value_of("repository").throw_if_none();
383+
let output = command.get_value_of("output").to_option();
384+
>>>>>>> refs/remotes/origin/main
194385
let display = command.has("display");
195386

196387
let output = output_to_path(output);

0 commit comments

Comments
 (0)