nctu_oj_cli

Version, currently master branch1 version
  • master branchlatestSep 2, 2021

github.com/c910335/nctu-oj-cli

CLI for NCTU OJ

7 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  nctu_oj_cli:
    github: c910335/nctu-oj-cli
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
1.0.0
License
MIT
Author
Tatsiujin Chin <c910335@gmail.com>
Target
  • nctu_oj from src/nctu_oj.cr

Dependencies

Runtime Dependencies

  • kilt~> 0.6.1github: jeromegn/kilt
  • slang~> 1.7.3github: jeromegn/slang
  • admiral~> 1.11.4github: jwaldrip/admiral.cr

Development Dependencies

  • ameba~> 0.14.3github: crystal-ameba/amebadev

README

# NCTU OJ CLI

[![Crystal CI](https://github.com/c910335/nctu-oj-cli/actions/workflows/crystal.yml/badge.svg)](https://github.com/c910335/nctu-oj-cli/actions/workflows/crystal.yml)

CLI for [NCTU OJ](https://oj.nctu.edu.tw)

## Installation

1. Clone this repository.

```sh
$ git clone https://github.com/c910335/nctu-oj-cli.git
$ cd nctu-oj-cli
```

2. Compile it.

```sh
$ shards build
```

3. Edit the configuration file.

```sh
$ cp config.sample.yml config.yml
$ vim config.yml
```

## Usage

```
$ bin/nctu_oj --help
Usage:
  bin/nctu_oj [flags...] [arg...]

CLI for NCTU OJ (https://oj.nctu.edu.tw)

Flags:
  --help      # Displays help for the current command.

Subcommands:
  codes       # Download all AC codes.
  scoreboard  # Generate a scoreboard into scoreboard.html
  testdata    # Upload test data
```

### Download Codes

```
$ bin/nctu_oj codes --help
Usage:
  bin/nctu_oj codes [flags...] [arg...]

Download all AC codes.

Flags:
  --help               # Displays help for the current command.
  --problem-id, -p     # Problem ID
  --students-only, -s  # Only download student's codes
```

### Generate Scodeboard

```
$ bin/nctu_oj scoreboard --help
Usage:
  bin/nctu_oj scoreboard [flags...] [arg...]

Generate a scoreboard into scoreboard.html

Flags:
  --help                                     # Displays help for the current command.
  --judge, -j (default: "pass")              # Judge type (must be pass or score)
  --message, -m                              # The message on the top of scoreboard
  --output, -o (default: "scoreboard.html")  # Output filename
  --refresh, -r                              # Auto refreshing period
```

### Upload Test Data

```
$ bin/nctu_oj testdata --help
Usage:
  bin/nctu_oj testdata [flags...] [arg...]

Upload test data

Flags:
  --clear, -c                     # Delete test data before upload
  --dir, -d                       # Test data dir
  --help                          # Displays help for the current command.
  --memory, -m (default: 262144)  # Memory limit (KB)
  --number, -n (default: 10)      # The number of test data includes sample
  --output, -o (default: 262144)  # Output limit (KB)
  --problem-id, -p                # Problem id
  --reducer, -r (default: "min")  # Reducer for score (must be min or sum)
  --sample, -s (default: 2)       # The number of sample test data
  --time, -t (default: 1000)      # Time limit (ms)
```

## Contributing

1. Fork it (<https://github.com/c910335/nctu-oj-cli/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [Tatsiujin Chin](https://github.com/c910335) - creator and maintainer