Categorygithub.com/Capobmb/bundle-helper
repository
0.0.0-20250123120514-b5951ca0ad76
Repository: https://github.com/capobmb/bundle-helper.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

bundle-helper

Goで書かれた、C++ファイルのコメントアウト制御ツール。
※注意:開発中なので、デバッグ用のログがstderrに出まくっています。

競技プログラミングで用いられるbundleツールにoj-bundleがありますが、 #ifdef ディレクティブ内に#includeが含まれていたり #pragma が含まれていたりすると正常にincludeの展開が出来ないので、このツールを作成しました。
oj-bundle 実行前にそのようなコードをコメントアウトしておいて、正常にbundleが実行してから、コメントアウトを戻すといった操作が将来的にできるようになる予定です。

Usage

go run cmd/main.go /path/to/source.cpp
# /path/to/source.cpp.converted.cpp にコメントアウトが制御されたコードが出力されます

コメントアウトの制御方法

// @bundle-helper COMMAND でコメントアウトを制御できます

これが

// @bundle-helper comment_single_line
constexpr int willBeCommentedOut = 1;

// @bundle-helper uncomment_single_line
// constexpr int willBeUncommented = 1;

// @bundle-helper comment_block_begin
Class WillBeCommentedOut {
    int member;
};
// @bundle-helper comment_block_end

// @bundle-helper uncomment_block_begin
// Class WillBeUncommented {
//     int member;
// };
// @bundle-helper uncomment_block_end

↓こうなる

// @bundle-helper comment_single_line
// constexpr int willBeCommentedOut = 1;

// @bundle-helper uncomment_single_line
constexpr int willBeUncommented = 1;

// @bundle-helper comment_block_begin
// Class WillBeCommentedOut {
//     int member;
// };
// @bundle-helper comment_block_end

// @bundle-helper uncomment_block_begin
Class WillBeUncommented {
    int member;
};
// @bundle-helper uncomment_block_end