Coder Social home page Coder Social logo

xxxbrian / cserun Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 1.17 MB

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

Home Page: https://cserun.bojin.co/

Rust 100.00%

cserun's Introduction


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.

CSERun Demo

Installation

Homebrew (recommended way if you are using macOS)

brew tap xxxbrian/tap
brew install cserun

Cargo

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

Configuration and Usage

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

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

To run a command, use CSERun as follows:

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. Here’s a breakdown of the configuration file and how to customize it:

# if you forget the configuration file path, you can use the --config option to display it
cserun --config

Server Configuration

[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 Configuration

You must choose one of the three available authentication methods. Each method has its own set of requirements:

1. Password Authentication

If you prefer using a password for authentication, uncomment and fill in the password field. If the password is not provided, CSERun will prompt you for it when needed.

[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. If your key is passphrase-protected, you can also specify the passphrase.

# [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.

# [auth]
type = "agent"

Note: Remember, these authentication methods are mutually exclusive; only one method should be configured in the file.

Completing the Configuration

After choosing and setting up your preferred authentication method, save the changes to the configuration file. Re-run CSERun in your project directory to start using it with the configured settings.

Advanced Usage

File ignore

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.

Arg usage

cserun [OPTIONS] <COMMAND>

Arguments

  • <COMMAND>: The command you wish to run on the CSE server.

Options

  • --config: This option is used independently of others to display the path of the configuration file used by CSERun.

  • --no-sync: Skip the file synchronization step before running the command. This is useful for commands that do not require the local files, such as 6991 classrun -sturec.

  • --env <KEY:VALUE>: Set environment variables for the session in the format of KEY:VALUE. You can specify multiple environment variables by repeating the --env option with different key-value pairs.

  • -h, --help: Display a help message with information on CSERun's usage and options.

  • -V, --version: Print the version of CSERun.

Examples

To run a command without syncing files and with environment variables set:

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

This example demonstrates how to execute a command that prints out the values of the environment variables uni and faculty, with those variables set to unsw and cse respectively, without syncing files to the CSE server before execution.

cserun --no-sync --env uni:unsw --env faculty:cse "echo \$uni; echo \$faculty"
[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

cserun's People

Contributors

xxxbrian avatar

Stargazers

kai avatar Jun avatar Yunshu Dai avatar WINN avatar Konrad Listwan-Ciesielski avatar Cicy Zhou avatar Minchuan Yang avatar

Watchers

 avatar  avatar

Forkers

typedefsy

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.