mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
force push format changes, add title to DIRECTORY.md
This commit is contained in:
parent
3496cf3fa1
commit
bc615f5bb9
12
.github/workflows/clang-format.yml
vendored
12
.github/workflows/clang-format.yml
vendored
@ -55,7 +55,7 @@ jobs:
|
|||||||
line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,"
|
line3: "AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,"
|
||||||
line4: "ColumnLimit: 80, AccessModifierOffset: -3 }"
|
line4: "ColumnLimit: 80, AccessModifierOffset: -3 }"
|
||||||
- name: Git Push
|
- name: Git Push
|
||||||
run: git pull && git push
|
run: git push --force origin HEAD:$GITHUB_REF || true
|
||||||
|
|
||||||
update_directory_md:
|
update_directory_md:
|
||||||
name: Update Directory.md
|
name: Update Directory.md
|
||||||
@ -64,7 +64,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v1
|
||||||
- name: update_directory_md
|
- name: Update DIRECTORY.md
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
import os
|
import os
|
||||||
@ -73,7 +73,6 @@ jobs:
|
|||||||
URL_BASE = "https://github.com/TheAlgorithms/C-Plus-Plus/blob/master"
|
URL_BASE = "https://github.com/TheAlgorithms/C-Plus-Plus/blob/master"
|
||||||
g_output = []
|
g_output = []
|
||||||
|
|
||||||
|
|
||||||
def good_filepaths(top_dir: str = ".") -> Iterator[str]:
|
def good_filepaths(top_dir: str = ".") -> Iterator[str]:
|
||||||
cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split())
|
cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split())
|
||||||
for dirpath, dirnames, filenames in os.walk(top_dir):
|
for dirpath, dirnames, filenames in os.walk(top_dir):
|
||||||
@ -82,11 +81,9 @@ jobs:
|
|||||||
if os.path.splitext(filename)[1].lower() in cpp_exts:
|
if os.path.splitext(filename)[1].lower() in cpp_exts:
|
||||||
yield os.path.join(dirpath, filename).lstrip("./")
|
yield os.path.join(dirpath, filename).lstrip("./")
|
||||||
|
|
||||||
|
|
||||||
def md_prefix(i):
|
def md_prefix(i):
|
||||||
return f"{i * ' '}*" if i else "\n##"
|
return f"{i * ' '}*" if i else "\n##"
|
||||||
|
|
||||||
|
|
||||||
def print_path(old_path: str, new_path: str) -> str:
|
def print_path(old_path: str, new_path: str) -> str:
|
||||||
global g_output
|
global g_output
|
||||||
old_parts = old_path.split(os.sep)
|
old_parts = old_path.split(os.sep)
|
||||||
@ -96,7 +93,6 @@ jobs:
|
|||||||
g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}")
|
g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}")
|
||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
|
|
||||||
def build_directory_md(top_dir: str = ".") -> str:
|
def build_directory_md(top_dir: str = ".") -> str:
|
||||||
global g_output
|
global g_output
|
||||||
old_path = ""
|
old_path = ""
|
||||||
@ -108,8 +104,7 @@ jobs:
|
|||||||
url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20")
|
url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20")
|
||||||
filename = os.path.splitext(filename.replace("_", " ").title())[0]
|
filename = os.path.splitext(filename.replace("_", " ").title())[0]
|
||||||
g_output.append(f"{md_prefix(indent)} [{filename}]({url})")
|
g_output.append(f"{md_prefix(indent)} [{filename}]({url})")
|
||||||
return "\n".join(g_output)
|
return "# List of all files\n" + "\n".join(g_output)
|
||||||
|
|
||||||
|
|
||||||
with open("DIRECTORY.md", "w") as out_file:
|
with open("DIRECTORY.md", "w") as out_file:
|
||||||
out_file.write(build_directory_md(".") + "\n")
|
out_file.write(build_directory_md(".") + "\n")
|
||||||
@ -134,6 +129,7 @@ jobs:
|
|||||||
- run: cpplint --filter=-legal --recursive .
|
- run: cpplint --filter=-legal --recursive .
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
name: Compile checks
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: [cpplint, update_directory_md]
|
needs: [cpplint, update_directory_md]
|
||||||
strategy:
|
strategy:
|
||||||
|
Loading…
Reference in New Issue
Block a user