Skip to content

Commit b36f011

Browse files
committed
feat: custom index command
1 parent 89421a9 commit b36f011

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: "specific lsif file input"
3838
default: ""
3939
required: false
40+
index_cmd:
41+
description: "custom index command"
42+
default: ""
43+
required: false
4044
runs:
4145
using: 'docker'
4246
image: 'Dockerfile'

debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def debug_main():
1111
check_call(["git", "clone", "--depth=2", "https://github.com/gin-gonic/gin.git"])
1212
# check_call(["git", "clone", "--depth=2", "https://github.com/square/okhttp"])
1313

14-
gen_index("golang", "gin")
14+
gen_index("golang", "gin", "")
1515
# gen_index("kotlin", "okhttp")
1616

1717
os.chdir("gin")

index.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
from utils import check_call
66

77

8-
def gen_index(lang: str, directory: str):
8+
def gen_index(lang: str, directory: str, index_command: str):
99
current_directory = os.getcwd()
1010
try:
1111
os.chdir(directory)
12+
13+
if index_command:
14+
logger.info(f"custom index command: {index_command}")
15+
check_call(index_command.split(" "))
16+
1217
if lang == "golang":
1318
gen_golang_index()
1419
elif lang == "python":

main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def main():
3333
openai_api_key = args[5]
3434
debug_mode = args[6]
3535
lsif_file = args[7]
36+
index_command = args[8]
3637

3738
if debug_mode:
3839
logger.warning("in debug mode, start testing")
@@ -57,7 +58,7 @@ def main():
5758
logger.info(f"files: {files}")
5859

5960
if not lsif_file:
60-
gen_index(lang, user_dir)
61+
gen_index(lang, user_dir, index_command)
6162
gen_diff(before_sha, after_sha, lsif_file)
6263

6364
with open(csv_result_file, encoding="utf-8") as f:

test_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
def test_index_py():
5-
gen_index("python", ".")
5+
gen_index("python", ".", "")

0 commit comments

Comments
 (0)