venus-acm
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

venus-acm


Why

In ACM competitions or when writing algorithmic questions, usually only a single file can be submitted to the online judgment system. But there are many mature algorithms or data structures that can be used as black-box code (such as Binary Search Tree), so you can maintain your own code base and import local algorithm codes through the -I option of the g++ compiler.

The goal of this project is to parse the cpp source code and replace the source code of the local cpp source files with the corresponding #include macro declarations.

Install

  • npm

    npm install -g venus-acm
  • yarn

    yarn global add venus-acm

Usage

$ venus --help

Usage: venus-acm [options] [command]

Options:
  -V, --version                                     output the version number
  --log-level <level>                               specify logger's level.
  --log-name <name>                                 specify logger's name.
  --log-mode <'normal' | 'loose'>                   specify logger's name.
  --log-flag <option>                               specify logger' option.
                                                    [[no-]<date|title|colorful|inline>] (default: [])
  --log-filepath <filepath>                         specify logger' output path.
  --log-encoding <encoding>                         specify output file encoding.
  -c, --config-path <configFilepath>                config filepaths (default: [])
  --parastic-config-path <parasticConfigFilepath>   parastic config filepath
  --parastic-config-entry <parasticConfigFilepath>  parastic config filepath
  --encoding <encoding>                             default encoding of files in the workspace
  -h, --help                                        display help for command

Commands:
  generate|g [options] <sourc> [outpu]
  help [command]                                    display help for command

Sub-command init

  • Overview

    $ venus init --help
    Usage: venus-acm init|i [options] <workspace>
    
    Options:
      --plop-bypass <plopBypass>  bypass array to plop (default: [])
      -h, --help                  display help for command
    • Arguments

      • <workspace>: location of the cpp project root dir.
  • Example

    $ venus init acm-cpp

    Then, a directory named acm-cpp with structure like below will be created:

    acm-cpp
      ├── .vscode
      │   └── settings.jsonp
      ├── oj
      │   └── fake
      │       └── 01.cpp
      ├── script
      │   └── run.js
      ├── src
      │   └── @guanghechen
      │       └── algorithm
      │           └── match-first.hpp
      ├── .clang-format
      ├── .editorconfig
      ├── .eslintignore
      ├── .eslintrc
      ├── .gitignore
      ├── .prettierignore
      ├── .prettierrc
      ├── CMakeLists.txt
      └── package.json

Sub-command generate

$ venus generate --help
Usage: venus-acm generate|g [options] <source filepath> [output filepath]

Options:
  --remove-comments                     remove comments
  --no-remove-comments
  --remove-spaces                       remove spaces
  --no-remove-spaces
  --remove-freopen                      remove freopen statements
  --no-remove-freopen
  --remove-assert                       remove assert statements
  --no-remove-assert
  -u, --uglify                          shortcut of --rc --rs.
  --no-uglify
  -c, --copy                            write generated code into system clipboard
  --no-copy
  -f, --force                           force write the generated code into output filepath
  --no-force
  -I, --include <include_directory...>  include directories
  -o, --output <output filepath>        specify the output filepath
  -h, --help                            display help for command
  • Arguments

    • <source filepath>: The entry filepath of cpp source codes.
    • [output filepath]: The output filepath that the generated codes writes to.
  • Options

  • Example

    venus generate oj/fake/01.cpp --output venus.cpp --copy

    Then, the generated code will be copied to the system clipboard and saved into venus.cpp.

Package Sidebar

Install

npm i venus-acm

Weekly Downloads

26

Version

2.0.1

License

MIT

Unpacked Size

54.6 kB

Total Files

19

Last publish

Collaborators

  • lemonclown