Skip to content

Commit

Permalink
update(README.md) update README and Chinese translate
Browse files Browse the repository at this point in the history
update README
  • Loading branch information
Estrella-Explore committed Nov 24, 2024
1 parent fa6604a commit a4963f1
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 36 deletions.
105 changes: 87 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,98 @@
# Description
# **gcc_strict-flags**

> This is a single file compile script which enables the **STRICTEST compiler flags** for OIers.
> This is a single file compile script which enables the **STRICTEST compiler flags** for competitive programming.
# How to use
<div style="text-align:center;">
<a href="README_zh-CN.md"
style="
display: inline-block;
padding: 2px 8px;
font-size: 14px;
color: white;
background-color: #b3243e;
border: none;
border-radius: 4px;
text-decoration: none;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s, transform 0.2s;
"
onmouseover="this.style.backgroundColor='#0056b3'; this.style.transform='scale(1.05)';"
onmouseout="this.style.backgroundColor='#007BFF'; this.style.transform='scale(1)';">
简体中文
</a>
</div>

```bash
sh make.sh demo/foo.cpp
```
---

The executable program `foo.out` is in the same directory as your source code file.
## **Features**

# News
- Compiles C++ files with strictest flags ever and some assist debugging flags.
- Detects test case files (`*.in`) and automatically redirects output to `*.ans`.

- User-friendly and colorful prompts.
---

- If test case `foo.in` was found, you can pass it as `stdin` to your program. \
Your answer will be output, and be saved as `foo.ans` by default.
## **Usage**

# Tips
1. **Download `make.sh` from release:**

1. You can name your test case `foo.in` and put it in the same directory as `foo.cpp` and enjoy easy input!
> You may clone this repo and try the demos first.
2. Don't want to type choices? \
Just keep it **_empty_** and press `Enter` to use default choice.
2. **Installation**

3. `sh make.sh foo.cpp` is too loooooong? \
Rename `make.sh` as your favourite name `fkccf`, and copy it to `/usr/bin/`. \
Once you restart your terminal, you can enjoy `fkccf foo.cpp` in any directory you want!
```bash
chmod +x ./make.sh
sudo cp ./make.sh /usr/bin/fkccf
```

3. **Run the script with your C++ file:**

```bash
fkccf <your_file.cpp>
```

4. **Key functionalities:**
- **Compilation:** The script compiles the provided C++ file and generates an executable (`*.out`).
- **Automatical test:** If `<filename>.in` exists, you will be prompted to use it as `stdin`. Output is saved as `<filename>.ans`.

---

## **Requirements**

- **g++:** Ensure `g++` is installed with support for C++14 or later.
- **Bash:** The script is written for Bash environments (Linux, macOS, WSL, etc.).

---

## **Example Workflow**

Given a file `example.cpp`:

1. Run the script:
```bash
fkccf example.cpp
```

2. If `example.in` exists, the script prompts:
```text
[Info]: Test case example.in detected.
------> Use this test case as stdin? [Y/n]
```
3. If confirmed, output is saved in `example.ans` and displayed in the terminal.
---
## **License**
This repo is licensed under the [GPLv3 License](./LICENCE).
# Star History
<a href="https://star-history.com/#estrella-explore/gcc_strict-flags&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date" />
</picture>
</a>
103 changes: 85 additions & 18 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,96 @@
# 描述
# **gcc_strict-flags**

> 这是为 OIer 启用**最严格的**编译选项的单文件编译脚本
> 这是一个适用于竞争性编程的启用 **最严格的编译器标志** 单文件编译脚本
# 使用方法
<div style="text-align:center;">
<a href="README.md"
style="
display: inline-block;
padding: 2px 8px;
font-size: 14px;
color: white;
background-color: #1d6ea3;
border: none;
border-radius: 4px;
text-decoration: none;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s, transform 0.2s;
"
onmouseover="this.style.backgroundColor='#0056b3'; this.style.transform='scale(1.05)';"
onmouseout="this.style.backgroundColor='#007BFF'; this.style.transform='scale(1)';">
English
</a>
</div>

```bash
sh ./make.sh ./demo/foo.cpp
```
---

可执行文件 `foo.out` 与你的源代码文件在同一目录下。
## **功能特点**

# 新功能
- 使用最严格的编译器标志编译 C++ 文件,并附加一些辅助调试标志。
- 自动检测测试样例文件(`*.in`),并将输出重定向到 `*.ans`

- 用户友好的状态提示
---

- 如果测试用例 `foo.in` 存在,你可以把它作为默认输入流传输给你的程序。\
你的答案会被输出,并且被默认地保存为 `foo.ans`
## **使用方法**

# 提示
1. **从发布页面下载 `make.sh` 文件:**
> 您可以先把该仓库 clone 到本地,并尝试 `./demo` 文件夹下的各种示例文件。
1. 你可以把你的测试用例命名为 `foo.in`,并把它放在与 `foo.cpp` 相同的目录下,以便便捷输入!
2. **安装方法**

2. 不想键入选项? \
只需要留空并按下回车键来使用默认选项。
```bash
chmod +x ./make.sh
sudo cp ./make.sh /usr/bin/fkccf
```

3. `sh make.sh foo.cpp` 太长了? \
`make.sh` 重命名为你最喜欢的名字 `fkccf.sh`,并把它复制到 `/usr/bin`\
只要重启终端,你就可以在任何目录下使用 `fkccf foo.cpp`
3. **使用 C++ 文件运行脚本:**

```bash
fkccf <your_file.cpp>
```

4. **功能:**
- **编译:** 脚本将编译提供的 C++ 文件并生成可执行文件(`*.out`)。
- **自动化测试:** 如果存在 `<filename>.in` 文件,脚本会提示是否将其作为 `stdin` 使用,输出将保存为 `<filename>.ans`

---

## **运行环境要求**

- **g++:** 确保已安装支持 C++14 或更高版本的 `g++`(推荐使用 `g++` 的最新版本,目前为 `g++ 14.2.1`)。
- **Bash:** 该脚本适用于 Bash 环境(MinGW、WSL、Linux、macOS 等)。

---

## **示例用法**

假设有一个文件 `example.cpp`

1. 运行脚本:
```bash
fkccf example.cpp
```

2. 如果存在 `example.in` 文件,脚本会提示:
```text
[Info]: Test case example.in detected.
------> Use this test case as stdin? [Y/n]
```
3. 如果输入 `y` 或者直接按下 `Enter`,程序会把 `example.in` 作为输入文件,而输出将保存到 `example.ans` 并显示在终端中。
---
## **许可证**
该项目基于 [GPLv3 许可证](./LICENCE) 进行授权。
# Star History
<a href="https://star-history.com/#estrella-explore/gcc_strict-flags&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=estrella-explore/gcc_strict-flags&type=Date" />
</picture>
</a>

0 comments on commit a4963f1

Please sign in to comment.