Code Monkey home page Code Monkey logo

keshav2010 / picocli Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 21.16 MB

picoCLI is a small command interpreter that can be used to write/read text files, setup trigger-alarms to execute another piece of code after specified amount of time.

Home Page: https://github.com/keshav2010/picoCLI/releases

License: MIT License

C++ 97.96% C 2.04%
cpp cli commandline-interface visual-studio-code c-plus-plus windows-desktop command-line-parser command-line-interpreter parsing interpreter

picocli's Introduction

picoCLI

picoCLI is a tiny program with Command line interface written in C++ (Tested on Windows 7, 32 bit)

  1. quickly create/append to text-files and make short-notes/reminders
  2. quickly read from text-files
  3. invoke a command(pre-defined as well as system-level commands such as shutdown) within specified time period by initiating a countdown timer

Command Construct picoCLI breaks a command into 4 parts ( * in front means this part is required)

  1. MAJOR* : The MAJOR part specifies the major action that command will initiate, for example "read" or "write" in case of input-output
  2. SUBMAJOR : SUBMAJOR is an optional part, that means a user can constructs his/her own command without need to mention SUBMAJOR command
  3. SUBCMD* : SUBCMD stands for sub-command, this serve as a parameter to MAJOR command, every command that picoCLI contains, need a parameter to act upon
  4. USERINPUT : in case a command needs user-input, user can write code for specifying USERINPUT properties

command.h : Abstract Class command.h is an abstract class every command (predefined or defined by programmer) must inherit publically it specifies the properties of a command such as

  1. isValid
  2. Pattern[6]
  3. MAJOR, SUBMAJOR, SUBCMD, USERINPUT

and some Functions

  1. int sumPattern(int beg, int end)
  2. int check_cmd(const std::string&)//needs to be override by programmer
  3. void execute_cmd() //needs to be override by programmer

check_cmd function should check a command syntax, if its valid, return 1 else return 0

execute_cmd function should be responsible for execution of a command

# #Existing Commands

  1. read file [ filename.txt ]
  2. write file [ filename.txt ] < userinput here >
  3. do [ (any command here) ] < seconds here >
  4. shutdown
  5. -q

# #Examples

  1. write file [ myfile.txt ] < this goes in file >
  2. do [ write file [ myfile.txt ] < this goes in file too > ] < 2 >
  3. do [ do [ write file [ myfile.txt ] < third line > ] < 2 > ] < 3 >
  4. read file [ myfile.txt ]
  5. do [ shutdown ] < 50 >

**execution will be like ** myfile.txt will be created and first line will be written ("this goes in file") next, a do-trigger alarm is set, after 2 second, it will re-open file and write "this goes in file too" as second line next a do-trigger alarm is set, after 3 second, it calls another do-alarm, which now execute for further 2 seconds (total : 5 second pause) and finally "third line" will be written to file

read file command will show content of file and lastly, do statement will execute shutdown command after 50 seconds, Shutting down the operating system (windows)

picocli's People

Contributors

jainsakar avatar keshav2010 avatar shashank9830 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

picocli's Issues

Code Documentation Needed [Beginner]

If you are wishing to contribute, you can start by documenting existing code by adding comments or updating the wiki, I believe it will help you understand existing code better way and even help you spot mistakes in my existing code.
In case you find out any useless piece of code or you want to change existing code (in case a better alternative exists) then do open an issue first before altering existing code.

Cmd_do required

MAJOR : do
SUBMAJOR : (not required)
SUBCMD : subcmd should be a valid command, nesting of do-command is allowed
USERINPUT : userinput is constrained to be time input, in the form of hms (hours,minute,seconds)
example
do [ read file [ filename.txt ] ] < 2h >

time will be internally converted to seconds, and count-down will begin, and finally the SUBCMD will execute after 2hours

nesting of do- command is allowed
do [ do [ read file [ keshav.txt ] ] <2h> ] < 2h >
after 2h, another do statement will execute
then again after 2h, read file command will execute
hence total time taken for read file [ keshav,txt ] command to execute is 4h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.