Introducing utopian-cli - A command-line interface for the Utopian.io API

Words
454
Reading
3 min
9y
Listen to this post
~3 min

wowow.png

I was recently browsing the development section of Utopian.io and one of the contributions caught my eye: A command line GoDaddy API Implementation (in Python). When I saw this I knew I wanted to make my own CLI, more specifically a Utopian.io CLI, so I started looking for ways to implement one, and ended up deciding to use the Python package Click.

What is the project about?

As mentioned above, it's a command-line interface implemented using the Python package Click. Some more information about it can be found in the README of my GitHub repository! I wanted to implement this because of a few reasons, but the main ones were that I wanted to learn about how to implement a CLI (I still am learning and will improve it along the way) and because I thought it would be useful for myself and other Utopian.io users who use the terminal regularly.

Usage: utopian [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  contributions
  moderators

Currently it allows the user to filter moderators and contributions and print them to the terminal. Below I will show an example of both commands with their respective options!

Moderators

One of the CLI's commands is the "moderators" command. Its options are currently

image.png

which are shown in action in the GIF below

utopian_moderators.gif

Contributions

The other command is the "contributions" command. Its options are currently

image.png

of which some are shown in the GIF below

utopian_contributions.gif

The only option that I didn't show in the GIF is the --reviewed / --unreviewed flag, which is very useful in my opinion and allows you to find e.g. unreviewed Dutch translations (very useful for me)!

Technology stack

I used the following to create the CLI

  • Python3.6 using Click and requests

I haven't tested it with other versions, except Python2.7, and it doesn't work for that. In the future I will look at adding support for multiple versions and actually testing them to see if they work or not.

Roadmap

I don't have any definite plans, but I might make it show the permlink of contributions instead of the title and I will work on adding the rest of the Utopian.io API to the CLI. I will probably think of other things that will help me personally (when moderating for example) and add them as well. I am also hoping people will suggest commands/options/arguments they would like to see implemented, so if you have any, let me know!

How to contribute?

  1. Fork the repository
  2. Create a feature branch with git checkout -b your-feature
  3. Code and document your feature
  4. Commit your changes with git commit -m "add my features"
  5. Push to your branch with git push origin your-feature
  6. Create a new pull request

Anything you can add to the project is valuable to me, be it bug reports, suggestions etc. so please don't hesitate!



Posted on Utopian.io - Rewarding Open Source Contributors

Introducing utopian-cli - A command-line interface for the Utopian.... | Ecency