Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions .github/workflows/GoBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Install dependencies
run: |
go mod tidy
go get .
go-version-file: go.mod

- name: Build
run: |
Expand All @@ -49,12 +44,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Install dependencies
run: |
go mod tidy
go get .
go-version-file: go.mod

- name: Build Windows Executable
run: |
Expand Down Expand Up @@ -256,12 +246,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Install dependencies
run: |
go mod tidy
go get .
go-version-file: go.mod

- name: Extract version
id: extract_version_macos
Expand Down Expand Up @@ -550,12 +535,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Install dependencies
run: |
go mod tidy
go get .
go-version-file: go.mod

- name: Build Android Binary
run: |
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/gofmt.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Go Format
name: Go Quality

on:
pull_request:
branches: ["**"]

jobs:
gofmt:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version-file: go.mod
- name: Check gofmt
run: |
UNFORMATTED=$(gofmt -l $(git ls-files '*.go'))
Expand All @@ -21,3 +21,9 @@ jobs:
echo "$UNFORMATTED" >&2
exit 1
fi
- name: Check module files
run: go mod tidy -diff
- name: Run go vet
run: go vet ./...
- name: Run tests
run: go test ./...
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version-file: go.mod

- name: Extract version from debug.go
id: extract_version
Expand Down
83 changes: 30 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,24 @@

## Overview

**cli-top** is an easy-to-use tool for VIT students that helps them quickly access important information from the VTOP student portal. Whether it's checking grades, viewing the timetable, or handling assignments, cli-top makes it simple to get what you need.


**cli-top** gives VIT students quick terminal access to VTOP records, schedules, course resources, and campus services.

## Features

- **Login**: Secure login to the VTOP portal
- **Mark View**: Check your marks for various courses
- **Digital Assignment**: Manage your digital assignment submissions
- **Course Page**: Access course materials and updates
- **Academic Calendar**: Keep track of important academic dates
- **Holiday List**: See upcoming holidays that actually cancel your classes
- **Today Planner**: See today's classes and whether attendance gives you room to skip any
- **Tomorrow Planner**: See tomorrow's classes and whether attendance gives you room to skip any
- **Day After Planner**: See the day after tomorrow's classes and whether attendance gives you room to skip any
- **Exam Schedule**: View upcoming exam schedules
- **Attendance Calculator**: Calculate your attendance percentage
- **Time Table**: Easily view your class schedule
- **Class Messages**: Stay updated with class announcements
- **Leave Status**: Check the status of your leave applications
- **Nightslip**: Monitor hostel nightslip requests and submit a new one when none is pending
- **Library Dues**: Stay on top of library dues
- **Receipts**: Access fee receipts and payment history
- **Grade View**: Review your grades and academic performance
- **Student Profile**: View personal details
- **Hostel Info**: Check hostel details
- **CGPA View**: Track your cumulative GPA over semesters
- **Syllabus**: Easily download syllabus files
- **Facility**: View hostel facilities
- **Logout**: Securely logout from the CLI

- **Academic records:** attendance, marks, grades, CGPA, exam schedules, and profile details
- **Planning:** timetable, academic calendar, holidays, and attendance-aware plans for today, tomorrow, and the day after
- **Course tools:** course allocation, current and archived course materials, syllabi, and digital-assignment status and question papers
- **Campus services:** events, facilities, hostel details, leave, nightslips, library dues, and receipts
- **Communication:** class messages and announcements
- **Local account management:** encrypted credential storage and logout

See the [command reference](docs/FEATURES.md) for every command, alias, and flag.

## Tech Stack

- **GoLang** : Core programming language
- **Cobra** : Go library for creating the terminal CLI


## Installation

To install **cli-top**, you can download the binary directly from [cli-top.acmvit.in](https://cli-top.acmvit.in/).
Expand All @@ -69,6 +48,7 @@ To install **cli-top**, you can download the binary directly from [cli-top.acmvi
2. **Run the Binary:**

After downloading, navigate to the folder where the binary is saved and run it from your terminal:

```bash
./cli-top
```
Expand All @@ -83,40 +63,41 @@ CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o cli-top .

Using `-trimpath` removes local file paths from the executable and, together with `-ldflags "-s -w"`, helps reduce binary size.


## Usage

After installation, you can access various features of **cli-top** by running specific commands:

- **Login to VTOP:**
Store your VTOP credentials locally. Missing values are prompted for interactively:

```bash
./cli-top login
cli-top login [--username USERNAME] [--password PASSWORD]
```

- **View Marks:**
`login` encrypts and stores the password; the first portal-backed command performs the VTOP authentication.

Run a feature command:

```bash
./cli-top marks
```
- **Calculate Attendance:**
```bash
./cli-top attendance
```
- **Check Tomorrow's Skip Leverage:**
```bash
./cli-top tomorrow
cli-top marks
cli-top attendance --semester 1
cli-top exams --semester 1
cli-top today
cli-top msg # alias: class-messages
```
- **Check Today's Skip Leverage:**

List all public commands or inspect one command's flags:

```bash
./cli-top today
cli-top --help
cli-top attendance --help
```
- For a full list of commands and features of cli-top, you can run:

## Testing

```bash
./cli-top help
go test ./...
go test -race ./...
```

Cross-package workflow and executable tests live in [`tests/`](tests/). Package-local `_test.go` files are reserved for white-box unit tests that exercise unexported implementation details.

## Project Management

Expand All @@ -125,24 +106,21 @@ After installation, you can access various features of **cli-top** by running sp
- Push to the "dev" branch for testing and compatibility checks
- Main and dev branch pushes require approval from designated maintainers


## Authors

- [Saharsh Bhansali](https://github.com/saharshbhansali)
- [Manav Muthanna](https://github.com/ManavMuthanna)
- [Sarthak Gupta](https://github.com/gptsarthak)


## Maintainers

- [Garv Jain](https://github.com/notcoolgarv)
- [Tanmay Paturu](https://github.com/Tintedfireglass)
- [Shambhavi Paygude](https://github.com/shambhavipaygude)
- [Harshit Vootukuri](https://github.com/hvoot36)
- [Harshit Vootukuri](https://github.com/btcry)
- [Adheesh Garg](https://github.com/qwerty-dvorak)
- [Ishaan S](https://github.com/theg1239)


## Contributors

- [Prateek Srivastava](https://github.com/prateek-srivastava001)
Expand All @@ -162,7 +140,6 @@ After installation, you can access various features of **cli-top** by running sp
- [Shruthilaya K](https://github.com/shruthilayak11)
- [Srijan Srivastava](https://github.com/Srijan1202)


## License

Copyright (C) 2023-2026 ACM-VIT and cli-top contributors.
Expand Down
60 changes: 49 additions & 11 deletions cmd/creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"cli-top/debug"
"cli-top/helpers"
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
Expand All @@ -18,24 +19,61 @@ var credCmd = &cobra.Command{
Use: "login",
Short: "Login to VTOP",
Run: func(cmd *cobra.Command, args []string) {
helpers.Println("NOTE: Your password will be visible.")
username := promptInput("Enter your username: ")
password := promptInput("Enter your password: ")
key := GenerateAESKey()
username, _ := cmd.Flags().GetString("username")
password, _ := cmd.Flags().GetString("password")
if strings.TrimSpace(username) == "" {
username = promptInput("Enter your username: ")
}
if password == "" {
helpers.Println("NOTE: Your password will be visible.")
password = promptInput("Enter your password: ")
}
username = strings.ToUpper(strings.TrimSpace(username))
if username == "" || password == "" {
helpers.Println("Username and password are required.")
return
}

key, err := GenerateAESKey()
if err != nil {
if debug.Debug {
helpers.Println(err)
} else {
helpers.Println("Unable to initialize secure credential storage.")
}
return
}

encryptedPassword, err := encryptPassword(password, key)
if err != nil && debug.Debug {
helpers.Println("Error encrypting password:", err)
if err != nil {
if debug.Debug {
helpers.Println("Error encrypting password:", err)
} else {
helpers.Println("Unable to securely store the password.")
}
return
}

helpers.Printf("Logging in with username: %s\n", strings.ToUpper(username))
viper.Set("VTOP_USERNAME", "\""+strings.ToUpper(username)+"\"")
helpers.Printf("Logging in with username: %s\n", username)
viper.Set("VTOP_USERNAME", "\""+username+"\"")
viper.Set("PASSWORD", "\""+encryptedPassword+"\"")
viper.Set("KEY", "\""+key+"\"")

if err := viper.WriteConfigAs(exeConfigPath()); err != nil && debug.Debug {
helpers.Println("Error writing to .env file:", err)
configPath := exeConfigPath()
if err := viper.WriteConfigAs(configPath); err != nil {
if debug.Debug {
helpers.Println("Error writing to .env file:", err)
} else {
helpers.Println("Unable to write the cli-top configuration.")
}
return
}
if err := os.Chmod(configPath, 0o600); err != nil {
if debug.Debug {
helpers.Println("Error securing config file permissions:", err)
} else {
helpers.Println("Unable to secure the cli-top configuration.")
}
return
}

Expand All @@ -53,8 +91,8 @@ func promptInput(prompt string) string {
func init() {
credCmd.Flags().String("username", "", "Enter VTOP username")
credCmd.Flags().String("password", "", "Enter VTOP password")
credCmd.Flags().String("regno", "", "Enter VIT registration number")
viper.SetConfigType("env")
viper.SetConfigPermissions(0o600)
viper.SetConfigFile(exeConfigPath())
viper.ReadInConfig()
rootCmd.AddCommand(credCmd)
Expand Down
Loading
Loading