npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

baekjoon-cli-utils

v0.4.0

Published

Simple code runner and CLI tool for studying, testing and managing Baekjoon algorithm source codes efficiently

Downloads

14

Readme

baekjoon-cli-utils

NPM download total NPM version MIT license

코딩 테스트나 알고리즘 문제를 공부할 때, 풀었던 알고리즘 문제 풀이 과정을 좀 더 체계적으로 만들고, 관리할 수 있도록 만드는 것을 목표로 만든 CLI 도구입니다.

기능

  • 소스 코드 파일을 만들 때 프로그래밍 언어에 따라 다른 템플릿 코드를 선택할 수 있습니다.

  • 프로그래밍 언어에 사용되는 도구의 명령어들에 구애 받지 않고 한 번의 명령어 실행으로 여러 테스트들을 실행할 수 있습니다.

  • 표준 출력, 표준 에러를 나누어 각각 예쁘게 출력합니다.

  • 백준 서버에서 테스트들을 한 번에 내려 받을 수 있으며, 직접 테스트를 추가하거나 변경할 수 있습니다.

  • Git에 소스 코드를 커밋할 때 간편하게 체계적인 커밋 메시지 컨벤션을 사용할 수 있습니다.

Disclaimer:

설치

  1. 아래 npm 명령어를 실행합니다.
$ npm i -g baekjoon-cli-utils
  1. 프로젝트 루트 경로로 이동합니다 (.git 폴더가 존재하는 경로)

  2. 아래 명령어로 사용할 프로그래밍 언어와 코드 템플릿을 설정합니다.

$ baekjoon-cli config lang
$ baekjoon-cli config code-template

사용법

$ baekjoon-cli --help

  Commands
    create          Create the problem source code on the subdirectory, and fetch tests.
    run / test      Find, compile and run a problem source code, and print test results in pretty format.
    add-test        Add additional test manually by code editor.
    edit-test       Edit test manually by code editor.
    rm-test         Clear the specified problem's test.
    rm-tests        Clear all the problem's tests.
    view-tests      Print the problem's tests.
    open            Open the problem's URL in your browser.
    commit          Commit the problem source code to Git.
    push            Push the committed source code to Git.
    config          Check and update templates, configurations.

  Usage
    $ baekjoon-cli [create <problem_identifier>]
    $ baekjoon-cli [run <problem_identifier>]
    $ baekjoon-cli [add-test <problem_identifier>]
    $ baekjoon-cli [edit-test <problem_identifier> <test_index>]
    $ baekjoon-cli [open <problem_identifier>]
    $ baekjoon-cli [commit <problem_identifier>]
    $ baekjoon-cli [rm-test <problem_identifier> <test_index>]
    $ baekjoon-cli [rm-tests <problem_identifier>]
    $ baekjoon-cli [view-tests <problem_identifier>]

  Configs
    show            Show current configurations.
    lang            Default programming language to use.
    timeout         A timeout value of test runner. Test runner exit the test if the running time is greater than this value.
    code-template   Code template used by \`create\`.
    commit-message  Commit message template used by \`commit\`.

  Usage
    $ baekjoon-cli [config show]
    $ baekjoon-cli [config lang <language>]
    $ baekjoon-cli [config timeout <ms>]
    $ baekjoon-cli [config code-template]
    $ baekjoon-cli [config commit-message]

  Options
    --raw           Print stdout in raw format in test runner.
                    It could be useful when you debug the source code with an infinity loop since test runner will not wait for the child process to exit.

  Flag Examples
    $ baekjoon-cli test --raw 1000

지원하는 프로그래밍 언어

  • [x] C++
  • [x] C
  • [x] Java
  • [x] Node.js
  • [x] Python
  • [x] Go
  • [x] Rust
  • [x] Swift
  • [x] Ruby
  • [ ] Kotlin
  • [ ] D

런타임 설정

기본적으로, 해당 프로그램은 소스코드를 컴파일, 실행하기 위해 아래의 도구를 사용합니다.

따라서 아래 도구가 설치되어 있어야 합니다.

| Programming language | Compiler / Interpreter | | -------------------- | ------------------------ | | c | gcc | | c++ | g++ | | go | go | | java | javac | | javascript | node | | python | python3 | | ruby | ruby | | rust | rustc | | swift | swiftc |

위 런타임 설정을 변경하기 위해 runner-settings.json 파일을 만들 수 있습니다.

디폴트 파일은 아래와 같습니다.

소스 코드 템플릿

프로그래밍 언어 별로 코드 템플릿을 만들어 사용할 수 있습니다.

이 템플릿 파일은 baekjoon-cli create 명령어를 사용할 때 사용됩니다.

baekjoon-cli config code-template 명령어를 통해 현재 사용하는 언어의 코드 템플릿을 변경할 수 있습니다.

이 템플릿에서 아래 {variable} 매직 변수들은 오른쪽 값으로 대체됩니다.

| Variable | value | | -------------------- | ---------------------- | | id | Problem identifier | | title | Problem title | | text | Problem texts | | input | Problem input test | | output | Problem output test | | url | Problem url | | level | Problem level | | tags | Problem tags | | date | File created date |

예를 들어, {id}는 문제의 id 값으로 대체됩니다.

Git 커밋 메세지 템플릿

baekjoon-cli commit 명령어를 사용할 때 사용됩니다.

이 템플릿에서 아래 {variable} 매직 변수들은 오른쪽 값으로 대체됩니다.

| Variable | value | | --------------------- | ---------------------- | | id | Problem identifier | | title | Problem title | | url | Problem url | | level | Problem level | | date | File created date | | relativeDirectoryPath | Problem relative path |

예를 들어, {id}는 문제의 id 값으로 대체됩니다.

코드 에디터 변경하기

몇몇 커맨드는 소스 코드 에디터의 실행을 필요로 합니다. 이 때 사용될 에디터는 EDITOR란 환경 변수의 값을 설정함으로써 변경하실 수 있습니다.

Example