From f277f41d83d450a1f28d350bb7d6da075d1d2741 Mon Sep 17 00:00:00 2001 From: Anshul Gupta Date: Wed, 9 Apr 2025 13:24:53 -0700 Subject: Initial Commit Add cmake github workflow Install dependencies in gh action Fix missing directory Fix compiler errors Fix group name to gid conversion Force cjson to statically link Add header guards to query headers Add install and cpack to CMakeLists.txt Add config search and CLI arg parsing Improve docs for git.c Fix program continuing on -h flag --- hack/graphql_to_header.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 hack/graphql_to_header.py (limited to 'hack/graphql_to_header.py') diff --git a/hack/graphql_to_header.py b/hack/graphql_to_header.py new file mode 100644 index 0000000..da0107d --- /dev/null +++ b/hack/graphql_to_header.py @@ -0,0 +1,26 @@ +import sys +from pathlib import Path + +input_path = Path(sys.argv[1]) +output_path = Path(sys.argv[2]) +var_name = sys.argv[3] + +with input_path.open() as f: + lines = f.readlines() + +with output_path.open("w") as f: + f.write( + f'''#ifndef QUERIES_{var_name.upper()}_H +#define QUERIES_{var_name.upper()}_H + +''' + ) + f.write(f'const char *{var_name} =\n') + for line in lines: + escaped = line.rstrip('\n').replace('\\', '\\\\').replace('"', '\\"') + f.write(f' "{escaped}\\n"\n') + f.write(';\n') + f.write( + f''' +#endif // QUERIES_{var_name.upper()}_H +''') -- cgit v1.2.3