CSERun Logo

CSERun

A utility tool to run cse commands in your local terminal

CSERun is a utility tool designed to assist UNSW CSE students in running course commands such as autotest and give in their local environment.

Powered by Rust, it simplifies the process of executing course-specific commands directly from a local machine.

Get Started
local terminal

Installation

Homebrew (macOS)

Recommended installation method for macOS users. Install CSERun using Homebrew package manager:

sh
brew tap xxxbrian/tap
brew install cserun

Cargo (Rust)

For Rust users, install CSERun directly using Cargo package manager:

sh
cargo install cserun --git https://github.com/xxxbrian/cserun

Configuration and Usage

Initial Setup

After installation, navigate to the directory where you wish to run commands:

sh
cd /path/to/your/work # The directory to run commands in
# Example: cd ~/COMP6991/lab01/exercise01

To run a command, use CSERun as follows:

sh
cserun "your_command_here"
# Example: cserun "6991 autotest"

Configuration Details

After the initial run, CSERun will prompt you to create and modify a TOML configuration file. This file contains essential settings for connecting to the CSE server, including server details and authentication method.

You can check your configuration file location with:

sh
cserun --config

Server Configuration

toml
[server]
addr = "cse.unsw.edu.au" # Default server address, no need to change.
port = 22                # Default port, no need to change.
user = "z5555555"        # Replace "z5555555" with your actual zID.

Authentication Methods

You must choose one of the three available authentication methods:

1. Password Authentication

If you prefer using a password for authentication, uncomment and fill in the password field.

toml
[auth]
type = "password"
password = "your_password" # Optional. Recommended to fill for convenience.
2. Key Authentication

For those who use SSH keys, specify the path to your private key.

toml
# [auth]
type = "key"
private_key_path = "/path/to/private/key" # Required for key authentication.
# public_key_path = "/path/to/public/key" # Optional.
# passphrase = "your_passphrase" # Optional.
3. Agent Authentication

Agent authentication is useful if you have an SSH agent running that manages your keys.

toml
# [auth]
type = "agent"

Advanced Usage

File Ignoring

To enhance file synchronization speed with the server, CSERun supports .gitignore and .ignore files. It will exclude files and directories specified in these files from syncing, which is particularly useful for ignoring project-generated directories like node_modules and target.

Command Format

sh
cserun [OPTIONS] <COMMAND>

Available Options

  • --config: Display the path of the configuration file
  • --no-sync: Skip the file synchronization step before running the command
  • --env <KEY:VALUE>: Set environment variables for the session
  • -h, --help: Display help information
  • -V, --version: Print the version

Example Commands

Run a command without syncing files and with environment variables set:

sh
cserun --no-sync --env uni:unsw --env faculty:cse "echo \$uni; echo \$faculty"

Example output:

[1/5] 🌐   Connecting to cse.unsw.edu.au:22
[2/5] 🔗   Handshake successful
[3/5] 🔒   Authenticated as z5555555
[4/5] 🚫   Skipped syncing local files
[5/5] ✨   Environment variables set
[5/5] 🚀   Command sented: echo $uni; echo $faculty
=============== Output ===============
unsw
cse
======================================
Exit status: Success