Git Product home page Git Product logo

atcoder-cli's Introduction

Tatamo's github stats

atcoder-cli's People

Contributors

avtomat2023 avatar dependabot[bot] avatar tatamo avatar uhyo avatar yistarostin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

atcoder-cli's Issues

Proxy環境下でacc loginに失敗する

素晴らしいツールの開発・メンテナンスありがとうございます。
本格的にatcoderがんばろうと、数ヶ月前に使い始めて便利に利用させていただいております。

普段と異なるネットワーク環境で利用の際、acc loginができなくなることがありました。
具体的には
http_proxyとhttps_proxyにはhttp://{username}:password}@{address}:portが設定されており、
curlで https://atcoder.jp/ に正常に接続できる状態で、acc loginを行ったところ下記のエラーとなりました。

(node:18257) UnhandledPromiseRejectionWarning: Error: Request failed with status code 301
    at createError (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/atcoder-cli/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:18257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

何か他の環境変数を設定して渡してあげなければならないなどありますでしょうか?
初めてIssuesを起票しましたので、適切でない点があれば合わせてご教授いただけますと幸いです。

ready to publish

  • double-check package.json, .npmrc, and so on
  • add more descriptions in --help
  • add README

some dependencies have been deprecated

npm install -g atcoder-cli shows warnings.

npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

template provisioning

  • detect template json files in config directory
  • copy program and the other static files
  • auto detection of submit file in submit command
  • custom command
    • provide directory path by environment variable

acc submit の際に "... no samples were downloaded ..." という警告がでる件について

とても便利なツールを開発・公開してくださりありがとうございます。

さて、表題の件ですが、 acc submit を実行すると

[WARNING] the problem "https://atcoder.jp/contests/abc101/tasks/abc101_b" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
Are you sure? Please type "abcb"

のようになり、 abcb などとタイプしないと提出できないのがわずかにですがわずらわしいです。

この件についてこちらに投稿することが適切でなければ申し訳ありませんが、これは online-judge-tools との依存関係に由来する仕様との理解でよろしいでしょうか。

online-judge-tools では ~/.cache/online-judge-tools/download-history.jsonl に該当するダウンロード履歴が記録されていないとこの警告が出る模様です。

そして oj/onlinejudge_command/subcommand/download.py の 134 行目で

https://github.com/online-judge-tools/oj/blob/70f8a29ae6a1f551fee50b35b61354ccbc81505f/onlinejudge_command/subcommand/download.py#L134

などとあって、 oj コマンドの呼び出し書式がデフォルトの場合にダウンロード履歴を記録する仕様のようです。

実際、初心者でよくわからないなりにコードを拝見し、

atcoder-cli/src/project.ts 194 行目

await OnlineJudge.call(["dl", task.url, "-d", testdir]);

                        await OnlineJudge.call(["dl", task.url]);

と改変し手元の環境でビルドしなおして実行してみたところ、上記の警告はなくなり [y/N] というプロンプトになりました。

しかし、このように修正してしまうとサンプル ケースを配置するディレクトリ名を変更できなくなるので、やはり本件は仕様ということでしょうか。

お時間に余裕のあるときにでも作者様のご意見をいただければ幸いです。

以上、よろしくお願いいたします。

Templateのsubmitでformatが使えない

Templateのオプションのひとつであるsubmitコマンドがformatを解釈しない問題が発生しています。
具体的には次のような状況にてエラーが発生します。

$ acc new abc001; cd abc001/a; tree .
########################################
# atcoder-cli/online-judge-tools outputs
########################################
.
|-- a.py
`-- test
    |-- sample-1.in
    |-- sample-1.out
    |-- sample-2.in
    |-- sample-2.out
    |-- sample-3.in
    `-- sample-3.out

$ acc s
submit to: https://atcoder.jp/contests/abc001/tasks/abc001_1
[INFO] online-judge-tools 11.1.3 (+ online-judge-api-client 10.8.0)
[INFO] problem recognized: AtCoderProblem.from_url('https://atcoder.jp/contests/abc001/tasks/abc001_1'): https://atcoder.jp/contests/abc001/tasks/abc001_1
[ERROR] [Errno 2] No such file or directory: '{tasklabel}.py'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/main.py", line 280, in main
    run_program(parsed, parser=parser)
  File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/main.py", line 250, in run_program
    submit(args)
  File "/usr/local/lib/python3.8/dist-packages/onlinejudge_command/subcommand/submit.py", line 42, in submit
    with args.file.open('rb') as fh:
  File "/usr/lib/python3.8/pathlib.py", line 1218, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib/python3.8/pathlib.py", line 1074, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '{tasklabel}.py'

template.jsononline-judge-toolsatcoder-cliのバージョンは以下の通りです。

{
  "task": {
    "program": [["main.py", "{tasklabel}.py"]],
    "submit": "{tasklabel}.py"
  }
}
 $ oj --version; acc --version
online-judge-tools 11.1.3 (+ online-judge-api-client 10.8.0)
2.1.0

どこかに間違っている設定があるのでしょうか。

提案: template generator を使いませんか

kmyk/online-judge-template-generator というのを開発しています。online-judge-tools/oj#687 で議論していたやつです。kyuridenamida/atcoder-tools のテンプレート生成機能だけを抜き出して再実装した感じです。
atcoder-cli との相性はそれほど良くはなさそうな感じはありますが、機能としては直交しているし組み合わせるとうれしいものであるはずなので、とりあえず提案しておきます。連携を検討してみてください。

? : 演算子使用時のエラー出力

ログイン結果の出力
console.log(await atcoder.login() ? "OK" : "login failed");
等の出力は
成功時も失敗時も同じく標準出力console.logが使用されていますが、
すでにログインしている場合の表示
console.error("you logged-in already");
のように、失敗時は標準エラー出力である、console.errorを利用していただきたいです。

More shell-friendly `task`, `contest` command

Current behavior

$ acc task abc100 abc100_a
A  Happy Birthday!  https://atcoder.jp/contests/abc100/tasks/abc100_a

$ acc task --id abc100 abc100_a
abc100_a  A  Happy Birthday!  https://atcoder.jp/contests/abc100/tasks/abc100_a

This looks better

$ acc task --id abc100 abc100_a
abc100_a

$ acc task --title abc100 abc100_a
Happy Birthday!

$ acc task --url abc100 abc100_a
https://atcoder.jp/contests/abc100/tasks/abc100_a

This causes breaking change, for the --id option.

loginコマンド時にオプションでユーザー名、パスワードを渡せるようにする

素晴らしいツールの開発・メンテナンスありがとうございます。1年近く利用させて頂いています。

docker containerでAtCoder用の環境を作り、その中で利用しているのですが、ユーザー名・パスワードを毎回打つのが面倒に感じています。online-judge-toolsのように以下のようなログインオプションがあったら、嬉しく存じます。

$ acc login --help             
Usage: index login [options]

login to AtCoder

Options:
  -u, --username <username>  your username
  -p, --password <password>  your password
  -h, --help                 output usage information

`acc new abc~` で作成されるサンプルケースのディレクトリが `tests`になっており、`online-judge-tools`と同時に使えない。

初めてIssueを書くので、不手際があったらすみません。
本日atcoder-cliをインストールして使ってみたのですが、どうやら、acc new abc~ で作成されるサンプルケースの名前がtestsになっており、一方online-judge-toolsでは testフォルダに対してチェックを行っているようで、

[WARNING] the problem "https://atcoder.jp/contests/abc190/tasks/abc190_a" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation

このように表示されます。
どこか設定等間違っていれば教えていただければ幸いです。

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.