Skip to content

araujobsd/cli-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc GitHub issues GitHub forks Go Report Card CircleCI

cli-example

It is a CRUD CLI implementation using Go1.12 that simulates an user listing products. It uses CSV to store the data, and all CRUD commands and others can be implemented dinamically without the need to restart the main program to load it.

How to build?

You can simple: sh build.sh OR make

How to run?

Proceed using run.sh OR ./thecarousell

List of commands implemented

  • register: Register an user. Only registered users can use the additional commands.
Usage:
   REGISTER user1
  • create_listing: Add an item for sale
Usage:
   CREATE_LISTING user1 'Phone model 8' 'Black color, brand new' 1000 'Electronics'
  • delete_listing: Remove an item for sale
Usage:
   DELETE_LISTING user1 itemID
  • get_listing: Find and print to stdout the item
Usage:
   GET_LISTING user1 itemID
  • get_category: Find and print to stdout all the items from a follow category
Usage:
   GET_CATEGORY user1 category {sort_price|sort_time} {asc|dsc}
  • get_top_category: Find an user category with the most items
Usage:
   GET_TOP_CATEGORY user1
  • update_listing: Update a product based on its id
Usage:
   UPDATE_LISTING user1 id <title> <description> <price> <category>

NOTE

We do a normalization on the command line, if you type REGISTER or ReGiStEr, we will find the right command for you. Also you can run the commands as a standalone command, just get into commands and run it using the same parameters above.

Copyright and licensing

Distributed under 2-Clause BSD License.

About

CRUD CLI usinc csv and Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published