DEV Community

Kaamkiya
Kaamkiya

Posted on • Edited on

Devcli - A CLI for Dev.to!

Introduction

I made a CLI app for Dev.to! I personally really like terminals, so I decided to make a CLI app so that I can read and reply to Dev articles.

This article was written because ofthis comment.Thanks@michaeltharrington!😄

Unfortunately, at the time of this article, the "write an article" feature didn't work, so I had to handwrite this.

What it does

So far, you can use devcli (very unoriginal name, I know) to...

  • read articles (and read the comments, too!)
  • view a list of your followers
  • view the 30 latest articles
  • display information about a user
  • see the tags that you follow
  • view yourreading list

If you have any new feature ideas, you can comment on this article oropen an issuein therepo😀

Using devcli

You can install it by following the instructions for your platform in theinstall guide,or just type the command below:

goinstallgithub.com/Kaamkiya/devcli
Enter fullscreen mode Exit fullscreen mode

Beware that the command above requiresGo.If you only want the binary for your platform, follow theinstructions.

Make sure the binary is in your$PATHvariable.

You can add it like this:

exportPATH="$PATH:$(goenvGOPATH)"# if you used Go to install
exportPATH="$PATH:/path/to/download "# if you installed the platform-specific binary
Enter fullscreen mode Exit fullscreen mode

Now, if you really want, you can read this article from the terminal 😄

devclireadkaamkiya/devcli-a-cli-for-devto-5gcb
Enter fullscreen mode Exit fullscreen mode

Otherwise, keep going!

API Keys and user-specific commands

Some commands require an API key. Here's how to get one:

Go to theextensions pageof dev.to.

Scroll until you see this:

API Keys

It should be somewhere near the bottom.

Enter a name for your API key. I recommend usingdevcli auth,because that way you know what the key is used for.

Press the big blue "Generate API key" button.

Scroll all the way back down, and click on the dropdown that says the name of your API key.

API key dropdown

Copy the key. It will be a long string of random characters.

Go to your terminal and type the following:

exportDEV_API_KEY="whatever_you_copy_pasted"
Enter fullscreen mode Exit fullscreen mode

NOTE: Never share your API keys!

Now you can run all of the commands. To check if it worked, trydevcli readinglist.

If it worked, your reading list has now been printed!

Cheat sheet

Here's a quick cheat sheet of the currently available commands:

devcliread$article_id# read an article by ID
devcliread$author/$article_slug# read an article by author/slug

devcli user$username# display info about a user

devcli following-tags# requires an API key

devcli followers# requires an API key

devcli readinglist# requires an API key

devcli latest# print a list of the 30 most recent articles

devclihelp# print a help message

# examples:
devcliread1690174
devcliread1690174--show-comments# display the top-level comments as well
devcli user ben# show stuff about @ben
Enter fullscreen mode Exit fullscreen mode

Feel free to contribute or try it out 😄

Let me know what you think!

Any new feature ideas? Feedback? I'd love to see what you think!

EDIT: Moved to Codeberg.

Top comments(2)

Collapse
michaeltharrington profile image
Michael Tharrington

This is so cool, Kaamkiya! Really appreciate ya sharing. 🙌

Collapse
michaeltharrington profile image
Michael Tharrington

I actually missed the shoutout you gave me the first time I read through. That was super kind of ya! Thanks a bunch. 😀

Some comments may only be visible to logged-in visitors.Sign into view all comments.