hedyhli / starcli

:sparkles: Browse trending GitHub projects from your command line
https://pypi.org/project/starcli/
MIT License
547 stars 50 forks source link

Bug: Error when trying to filter language to 'csharp' when also using '-d' filter #111

Open MostHated opened 2 years ago

MostHated commented 2 years ago

When filtering results, if using the language csharp on its own, it is fine, but if I add -d today, I get the error seen in the details dropdown below:

Error details

`-l csharp -d today` ```sh zsh  starcli -l csharp -d today Traceback (most recent call last): File "/home/mosthated/.pyenv/versions/3.9.9/bin/starcli", line 8, in sys.exit(cli()) File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/starcli/__main__.py", line 183, in cli tmp_repos = search_github_trending( File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/starcli/search.py", line 233, in search_github_trending gtrending_repo_list = fetch_repos( File "/home/mosthated/.pyenv/versions/3.9.9/lib/python3.9/site-packages/gtrending/fetch.py", line 30, in fetch_repos raise ValueError(f"Invalid language argument: {language}") ValueError: Invalid language argument: csharp ``` This demonstrates it not working, as well as working with the omission of the `-d` filter ![](https://i.imgur.com/gE9rKtQ.png)
# This works fine:
starcli -l csharp

# This does not
starcli -l csharp -d today

# I also tried a few others, but had the same results
starcli -l csharp -d this-week
starcli --lang csharp -d this-week
starcli -d today -l csharp 
starcli -d this-week -l csharp 

Just to check, I also tried the following, and it worked fine:

starcli -l rust -d today 

Python version 3.9.9

your operating system (and terminal type or shell of needed)

System Details ```sh mosthated@pop-os ---------------- OS: Pop!_OS 21.10 x86_64 Host: X570 AORUS ELITE -CF Kernel: 5.15.15-76051515-generic Uptime: 7 days, 16 hours, 39 mins Packages: 3947 (dpkg), 194 (brew), 76 (flatpak), 13 (snap) Shell: zsh 5.8 Resolution: 1920x1080, 2560x1080, 1920x1080 DE: GNOME 40.5 WM: Mutter WM Theme: Materia-dark-compact Theme: Materia-dark-compact [GTK2/3] Icons: Flatery-Orange-Dark [GTK2/3] Terminal: alacritty CPU: AMD Ryzen 9 3950X (32) @ 3.500GHz GPU: NVIDIA GeForce RTX 2070 Memory: 53130MiB / 64314MiB ```

starcli version starcli==2.17.1

hedyhli commented 2 years ago

Hi, I think I know what's causing this inconsistent behaviour. I'll get to it as soon as I get the chance, thanks!

Treehole commented 2 years ago

Hi, I think I know what's causing this inconsistent behaviour. I'll get to it as soon as I get the chance, thanks!

Hi, hedyhli. I like your project, so I want to work for this project. I check this issue and find the problem is your api(https://gtrend.yapie.me/languages) doesn't update with the language c#/csharp. If you have no time to do this, I am glad to fix this bug. Thanks for your Job!

hedyhli commented 1 year ago

It seems like the GitHub search API uses 'csharp' whereas GitHub Trending uses 'c#'. To have consistency we could change 'csharp' to 'c#' before calling the gtrending functions. Note that it appears there's also inconsistency with 'cpp' vs 'c++', possibly others too. It'd be nice to have all the language parameters for GitHub search work for GitHub Trending as well.

Apologies for the delay @Treehole, are you still interested in working on this?

CristhianMotoche commented 10 months ago

Hello there! Could I give a try to this issue?