Skip to content

jutge-org/jutge-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

98 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jutge CLI

A command-line interface for interacting with the Jutge.org platform API. Access your profile, submit solutions, upload problems, manage courses, and more directly from your terminal.

Key Features

  • πŸ’» Easy interface with Jutge.org API
  • πŸ‘¨β€πŸ« Student operations (profile, awards, submissions, courses)
  • πŸŽ“ Instructor operations (queries, course management)
  • πŸ” Multi-account authentication management
  • πŸ”„ Auto-login with saved credentials
  • πŸ“Š Multiple output formats (JSON, YAML, CSV, table, raw)
  • πŸ“ File upload and download support

Installation

The CLI requires Bun as a JavaScript runtime.

Quick Install

bun install --global @jutge.org/cli

Verify the installation:

jutge --version

Getting Started

First Time Setup

Login to your Jutge.org account:

jutge login

You'll be prompted for your email and password. Your credentials will be securely stored for future use.

Basic Usage

# Get help about available commands
jutge --help

# Explore specific sections
jutge student --help
jutge instructor --help

# View your profile
jutge student profile

# List your courses
jutge student courses list

Much more commands are available; use --help to explore them.

Account Management

The CLI supports managing multiple Jutge.org accounts, making it easy to switch between student and instructor roles or different user accounts.

Managing Accounts

# List all registered accounts
jutge accounts list

# Add a new account
jutge accounts add -e [email protected] professor

# Switch active account
jutge accounts use professor

# Use a specific account for one command
jutge student profile -a professor

# Remove an account
jutge accounts remove professor

# Rename an account
jutge accounts rename professor prof

# View the accounts manual
jutge accounts manual

Saving Passwords

For convenience, you can save the password of the current account locally (stored as base64):

jutge accounts save-password

Warning: Passwords are not securely encrypted. Use this feature at your own risk.

Default Output Format

Set a preferred output format for current account:

jutge accounts default-format json

Output Formats

The CLI supports multiple output formats for flexibility:

# JSON format (good for scripting)
jutge student profile --json

# Table format (human-readable)
jutge student courses list --table

# YAML format
jutge student awards list --yaml

# CSV format (for spreadsheets)
jutge instructor queries getCourseProblemSubmissions \
    --course_nm "PRO3_2024" \
    --problem_nm "P68688_ca" \
    --csv

# Raw format (no formatting)
jutge student profile --raw

Working with Files

# Upload a file (input files are always arguments)
jutge student profile updateAvatar photo.jpg

# Download a file (use -o to specify output name)
jutge student submissions download --submission_id S001 -o my-submission.zip

Advanced Features

Debug Mode

See the raw API request and response:

jutge student profile --debug

API Exploration

The CLI structure mirrors the Jutge.org API, making it easy to explore:

# Get help for any command
jutge student --help
jutge student courses --help
jutge instructor queries --help

# Each endpoint maps to a command
# API: student.profile β†’ CLI: jutge student profile
# API: instructor.queries.getCourseProblemSubmissions β†’
#      CLI: jutge instructor queries getCourseProblemSubmissions
# See the API documentation for more details:
# https://api.jutge.org

Configuration

Configuration files are stored in platform-specific locations.

Files

  • credentials.json - Account credentials and tokens
  • config.yml - General settings

Environment Variables

  • JUTGE_API_URL - Override the default API endpoint (default: https://api.jutge.org/api)

Example:

export JUTGE_API_URL="https://api-dev.jutge.org/api"
jutge student profile

Upgrading

Check for and install updates:

jutge upgrade

Troubleshooting

Authentication Issues

If you encounter authentication errors:

# Logout and login again
jutge logout
jutge login

# Check which account is active
jutge accounts list

Connection Issues

# Verify the API endpoint
echo $JUTGE_API_URL

# Check if the API is accessible
curl https://api.jutge.org/api/dir

Getting Help

  • Use --help with any command to see detailed usage
  • Check the Jutge.org documentation for API details
  • Report issues on the project repository

Requirements

  • Bun - JavaScript runtime (required)
  • Internet connection to access Jutge.org API

Support

License

Copyright Β© Jutge.org. All rights reserved.

About

Jutge Command Line Interface

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •