├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── config.yml │ └── feature_request.yml └── pull_request_template.md ├── .gitignore ├── Makefile ├── README.md ├── assets └── vitable.png ├── src └── vitable.nim └── vitable.nimble /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # @global-owner1 and @global-owner2 will be requested for 4 | # review when someone opens a pull request. 5 | # Please add names of code owners here and tag the below 6 | # Vishesh Bansal 7 | * @VisheshBansal 8 | # Gagan Malvi 9 | * @gaganmalvi 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: Report an issue to help improve the project. 3 | title: "[BUG] " 4 | labels: ["bug"] 5 | body: 6 | - type: textarea 7 | id: description 8 | attributes: 9 | label: Description 10 | description: A brief description of the question or issue, also include what you tried and what didn't work 11 | validations: 12 | required: true 13 | - type: textarea 14 | id: screenshots 15 | attributes: 16 | label: Screenshots 17 | description: Please add screenshots if applicable 18 | validations: 19 | required: false 20 | - type: textarea 21 | id: extrainfo 22 | attributes: 23 | label: Additional information 24 | description: Is there anything else we should know about this bug? 25 | validations: 26 | required: false 27 | - type: textarea 28 | id: logs 29 | attributes: 30 | label: Relevant log output 31 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 32 | render: shell 33 | - type: checkboxes 34 | id: checks 35 | attributes: 36 | label: Docs 37 | description: Make sure you went through the README file and docs 38 | options: 39 | - label: "I have went through the project's README file" 40 | required: true 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | name: config 2 | description: Setting config options for the workspace. 3 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest features, propose improvements, discuss new ideas. 3 | title: "[FEATURE] " 4 | labels: ["enhancement"] 5 | body: 6 | - type: textarea 7 | id: description 8 | attributes: 9 | label: Detailed description 10 | description: Provide a detailed description of the change or addition you are proposing 11 | validations: 12 | required: true 13 | - type: textarea 14 | id: context 15 | attributes: 16 | label: Context 17 | description: | 18 | Why is this change important to you? How would you use it? 19 | How can it benefit other users? 20 | validations: 21 | required: true 22 | - type: textarea 23 | id: possibleimpl 24 | attributes: 25 | label: Possible implementation 26 | description: Not obligatory, but suggest an idea for implementing addition or change 27 | validations: 28 | required: false 29 | - type: textarea 30 | id: extrainformation 31 | attributes: 32 | label: Additional information 33 | description: Is there anything else we should know about this feature? 34 | validations: 35 | required: false 36 | - type: checkboxes 37 | id: checks 38 | attributes: 39 | label: Docs 40 | description: Make sure you went through the README file and docs 41 | options: 42 | - label: "I have went through the project's README file" 43 | required: true 44 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Fixes Issue 2 | 3 | ## Changes proposed 4 | 5 | ## Screenshots 6 | 7 | ## Note to reviewers 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | vitable 3 | .vitable.json 4 | timetable.txt 5 | /.vscode -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY build: 2 | nimble install -y docopt --verbose 3 | nim -d:release -d:ssl c src/vitable.nim 4 | clean: 5 | rm -f src/vitable 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VITable-CLI 2 | 3 | > A CLI that shows classes right in Terminal for you. Written in Nim. 4 | 5 | [![DOCS](https://img.shields.io/badge/Documentation-see%20docs-green?style=flat-square&logo=appveyor)](https://vit-timetableapi.herokuapp.com/docs) 6 | 7 | ## Caution 8 | 9 | - The working of this for 2021-2025 batch students has NOT been extensively tested. Reporting any bugs is appreciated. 10 | - If you're a '25 batch student and don't see your course, please contact one of the maintainers and get your courses added. 11 | 12 | ## Screenshot 13 | 14 | ![VITable](/assets/vitable.png) 15 | 16 | ## Features 17 | 18 | - Shows all classes 19 | - Shows ongoing classes 20 | - Shows next class 21 | - Shows classes today 22 | 23 | ## Instructions to install (Unix Based Systems) 24 | 25 | You will need to install [Nim](https://nim-lang.org) on your host PC in order to run VITable. 26 | 27 | ### Linux 28 | 29 | Debian based operating systems - 30 | 31 | ```sh 32 | sudo apt install nim -y 33 | ``` 34 | 35 | And on Arch Linux - 36 | 37 | ```sh 38 | sudo pacman -S nim 39 | ``` 40 | 41 | After installing Nim, run the following. 42 | 43 | ```sh 44 | git clone "https://github.com/CartelProject/VITable-CLI" 45 | touch timetable.txt 46 | cd VITable-CLI 47 | make build 48 | ``` 49 | 50 | Now, to make it visible throughout system 51 | 52 | ```sh 53 | sudo cp src/vitable /usr/bin 54 | vitable -h 55 | ``` 56 | 57 | NOTE: On Arch Linux, vitable can be installed using the AUR! 58 | 59 | ## Instructions to install (Windows) 60 | 61 | ## Dependencies 62 | 63 | - [Chocolatey](https://chocolatey.org/install) 64 | - [Nim](https://nim-lang.org) 65 | - [Git](https://git-scm.com/download/win) 66 | 67 | ### These steps are for installing in the D drive 68 | 69 | Note Please, copy the contents of your timetable from VTOP -> Academics -> Time Table to timetable. 70 | 71 | ### Run the next steps in an elevated command shell 72 | 73 | ```psh 74 | C:\WINDOWS\system32> choco install make 75 | ``` 76 | 77 | ### Restart Terminal (Not necessarily elevated) 78 | 79 | ```psh 80 | D:\> mkdir Tools 81 | D:\Tools> cd Tools 82 | D:\Tools> git clone "https://github.com/CartelProject/VITable-CLI" 83 | D:\Tools> type nul >> C:\Users\%username%\timetable.txt 84 | D:\Tools> cd VITable-CLI 85 | D:\Tools\VITable-CLI> make build 86 | D:\Tools\VITable-CLI> set PATH=%PATH%;"D:\Tools\VITable-CLI\src" 87 | D:\Tools\VITable-CLI> vitable -h 88 | ``` 89 | 90 | Congratulations, VITable should be up and running now! 91 | 92 | ## Instructions to Install (Android) 93 | 94 | ### Dependencies for Android 95 | 96 | - A Terminal Emulator (Example: Termux, Termius) 97 | - A timetable.txt file (Preferable to first install on a desktop and transfer that file to mobile.) 98 | 99 | ### Preferred Installation Method 100 | 101 | #### Pre-Requisites 102 | 103 | - Download & Install [Termux](https://f-droid.org/repo/com.termux_117.apk) 104 | - Download & Install [Termux-API](https://f-droid.org/repo/com.termux.api_49.apk) 105 | - Install the Termux API package 106 | 107 | ```sh 108 | pkg install termux-api 109 | ``` 110 | 111 | - Assuming you have transferred the timetable.txt file from your desktop, run this command and allow permissions. 112 | 113 | ```sh 114 | termux-setup-storage 115 | ``` 116 | 117 | - Now we save the External timetable.txt file to the local termux file storage. 118 | 119 | ```sh 120 | termux-storage-get timetable.txt 121 | ``` 122 | 123 | - After running that command, navigate to the timetable.txt you have transferred from your desktop. 124 | 125 | #### Configuration 126 | 127 | - Installing nim and make. 128 | 129 | ```sh 130 | pkg install root-repo 131 | apt update && apt upgrade -y 132 | apt install nim -y 133 | pkg install make 134 | ``` 135 | 136 | - Cloning the Repository 137 | 138 | ```sh 139 | git clone "https://github.com/CartelProject/VITable-CLI" 140 | cd VITable-CLI 141 | ``` 142 | 143 | - Installing 144 | 145 | ```sh 146 | make build 147 | cd src 148 | cp src/vitable $HOME 149 | ./vitable 150 | ``` 151 | 152 | **Note: You may face an SSL Error, (1416F086), No fix for it is currently known. Troubleshooting includes, checking if your date/time is synced, disabling any AV's and VPN's and signing a new certificate.** 153 | 154 | ## Contributors 155 | 156 | - Vishesh Bansal 157 | - Gagan Malvi 158 | - Rishabh Agrawal 159 | 160 | ## License 161 | This application is licensed under the [Cartel Project Public License](https://github.com/CartelProject/cpl). 162 | 163 |

164 | Made with :heart: by The Cartel Family 165 |

166 | -------------------------------------------------------------------------------- /assets/vitable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartelProject/vitable/f982c55abd26a7bddc59830c19da074a08829b35/assets/vitable.png -------------------------------------------------------------------------------- /src/vitable.nim: -------------------------------------------------------------------------------- 1 | import os, json, times, strutils, docopt , httpclient, terminal 2 | 3 | let cliversion = "0.1.1" 4 | 5 | assert getHomeDir() == expandTilde("~") 6 | 7 | let p10kfunc = """ 8 | function prompt_vitable() { 9 | ttrem=$(vitable ongoing) 10 | if [ ! -z "$ttrem" ] 11 | then 12 | p10k segment -b yellow -f white -t "✎ $ttrem" 13 | else 14 | p10k segment -b yellow -f white -t "✎ No ongoing classes!" 15 | fi 16 | } 17 | """ 18 | 19 | let doc = """ 20 | __ _______ _______ _ _ 21 | \ \ / /_ _|__ __| | | | | 22 | \ \ / / | | | | __ _| |__ | | ___ 23 | \ \/ / | | | |/ _` | '_ \| |/ _ \ 24 | \ / _| |_ | | (_| | |_) | | __/ 25 | \/ |_____| |_|\__,_|_.__/|_|\___| 26 | 27 | View your timetable right in your terminal! 28 | 29 | Created with ❤️ by the Cartel Family. 30 | 31 | Developers: 32 | Gagan Malvi (https://github.com/gaganmalvi) 33 | Vishesh Bansal (https://github.com/VisheshBansal) 34 | Rishabh Agrawal (https://github.com/saintwithataint) 35 | 36 | USAGE: 37 | vitable (s | show | Shows all classes today) 38 | vitable (o | ongoing | Shows ongoing class) 39 | vitable (a | all | Shows full timetable) 40 | vitable (n | new | Add or edit Timetable) 41 | vitable p10k 42 | vitable (-h | --help) 43 | vitable (-v | --version) 44 | 45 | OPTIONS: 46 | -h, --help Show this screen. 47 | -v, --version Show the version. 48 | """ 49 | 50 | proc fetchreq() = 51 | var ttfile = getHomeDir() 52 | ttfile.add("timetable.txt") 53 | let f = open(ttfile) 54 | let data = readAll(f) 55 | var param = "request=" 56 | param.add(data) 57 | let client = newHttpClient() 58 | client.headers = newHttpHeaders({ "Accept":"application/json","Content-Type": "application/x-www-form-urlencoded" }) 59 | var path = getHomeDir() 60 | path.add(".vitable.json") 61 | let response = client.request("https://vit-timetableapi.herokuapp.com/fetch/", httpMethod = HttpPost, body = $param) 62 | if response.status == "200 OK": 63 | let resp = response.body 64 | writeFile(path, resp) 65 | styledEcho styleBright, fgGreen, "The timetable has been saved successfully. Please re-run vitable -h to know the list of commands you can now use." 66 | else: 67 | styledEcho styleBright, fgRed, "Something went wrong. Please retry once again." 68 | f.close() 69 | 70 | proc fetchNewTt() = 71 | echo "Copy your timetable from VTOP and paste it in timetable.txt, which should be placed in the home directory." 72 | echo "Do you want to proceed? [Y/N] " 73 | let ans = readLine(stdin) 74 | if ans=="y" or ans=="Y": 75 | fetchreq() 76 | 77 | let daynow = now() 78 | var daytoday = toUpperAscii(daynow.format("ddd")) 79 | 80 | proc showTT() = 81 | try: 82 | var path = getHomeDir() 83 | path.add(".vitable.json") 84 | let jsonNode = parseFile(path) 85 | var tt = jsonNode["Slots"] 86 | echo "Timetable for today." 87 | if daytoday == "SAT" or daytoday == "SUN": 88 | echo "No classes for today!" 89 | else: 90 | for i in tt: 91 | if getStr(i["Day"]) == daytoday: 92 | var 93 | course = i["Course_FullName"] 94 | coursecode = i["Course_Name"] 95 | coursetype = i["Course_type"] 96 | slot = i["Slot"] 97 | intime = i["StartTime"] 98 | outtime = i["EndTime"] 99 | echo "" 100 | echo "Course: ", getStr(course) 101 | echo "Course Code: ", getStr(coursecode) 102 | echo "Course Type: ", getStr(coursetype) 103 | echo "Timings: ", getStr(intime), " - ", getStr(outtime) 104 | echo "Slot: ", getStr(slot) 105 | except IOError: 106 | fetchNewTt() 107 | 108 | proc showAll() = 109 | try: 110 | var path = getHomeDir() 111 | path.add(".vitable.json") 112 | let jsonNode = parseFile(path) 113 | var tt = jsonNode["Slots"] 114 | echo "Full Timetable" 115 | for i in tt: 116 | echo "Day: ",getStr(i["Day"]) 117 | var 118 | course = i["Course_FullName"] 119 | coursecode = i["Course_Name"] 120 | slot = i["Slot"] 121 | intime = i["StartTime"] 122 | outtime = i["EndTime"] 123 | echo "Course: ", getStr(course) 124 | echo "Course Code: ", getStr(coursecode) 125 | echo "Timings: ", getStr(intime), " - ", getStr(outtime) 126 | echo "Slot: ", getStr(slot) 127 | echo "" 128 | except IOError: 129 | fetchNewTt() 130 | 131 | proc p10kInstall() = 132 | echo "VITable Powerlevel10k plugin.\n" 133 | echo "In ~/.p10k.zsh, add the following function.\n" 134 | echo p10kfunc 135 | echo "" 136 | echo "Now, add the definition vitable to LEFT or RIGHT arguments, whatever you prefer.\n" 137 | echo "Source .zshrc, or restart your terminal." 138 | 139 | proc classesOngoing() = 140 | try: 141 | var path = getHomeDir() 142 | path.add(".vitable.json") 143 | let jsonNode = parseFile(path) 144 | var tt = jsonNode["Slots"] 145 | if daytoday == "SAT" or daytoday == "SUN": 146 | echo "No classes today!" 147 | else: 148 | for f in tt: 149 | if getStr(f["Day"]) == daytoday: 150 | var timenow = daynow.format("HH:mm") 151 | var intime = getStr(f["StartTime"]) 152 | var outtime = getStr(f["EndTime"]) 153 | if timenow >= intime and timenow <= outtime: 154 | echo "Current Class: ", getStr(f["Course_FullName"]) 155 | except IOError: 156 | fetchNewTt() 157 | 158 | let args = docopt(doc, version = cliversion) 159 | 160 | if args["show"] or args["s"]: 161 | showTT() 162 | 163 | if args["p10k"]: 164 | p10kInstall() 165 | 166 | if args["ongoing"] or args["o"]: 167 | classesOngoing() 168 | 169 | if args["all"] or args["a"]: 170 | showAll() 171 | 172 | if args["new"] or args["n"]: 173 | fetchNewTt() 174 | -------------------------------------------------------------------------------- /vitable.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | description = "View your VIT timetable right in your terminal!" 5 | author = "Vishesh Bansal, Gagan Malvi & Rishabh Agrawal" 6 | license = "MIT" 7 | srcDir = "src" 8 | bin = @["vitable"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "docopt" 14 | requires "notify" 15 | --------------------------------------------------------------------------------