diff options
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rw-r--r-- | man/github_mirror.1 | 22 | ||||
-rw-r--r-- | man/github_mirror.conf.5 | 16 | ||||
-rw-r--r-- | src/config.c | 14 | ||||
-rw-r--r-- | src/config.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 |
6 files changed, 38 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a1e316..b5b8c75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.30) -project(github_mirror VERSION 0.1.4 LANGUAGES C) +project(github-mirror VERSION 0.1.4 LANGUAGES C) set(CMAKE_C_STANDARD 17) include(CheckCCompilerFlag) @@ -61,7 +61,7 @@ endforeach () add_custom_target(generate_graphql_headers ALL DEPENDS ${GENERATED_HEADERS}) # Executable -add_executable(github_mirror +add_executable(github-mirror src/main.c src/github.c src/github.h @@ -77,20 +77,20 @@ add_executable(github_mirror src/precheck.c src/precheck.h ) -target_link_libraries(github_mirror PRIVATE cjson CURL::libcurl) -target_include_directories(github_mirror PRIVATE ${CJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_compile_definitions(github_mirror PRIVATE +target_link_libraries(github-mirror PRIVATE cjson CURL::libcurl) +target_include_directories(github-mirror PRIVATE ${CJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_compile_definitions(github-mirror PRIVATE GITHUB_MIRROR_VERSION="${PROJECT_VERSION}" ) -add_dependencies(github_mirror generate_graphql_headers) -install(TARGETS github_mirror DESTINATION bin) +add_dependencies(github-mirror generate_graphql_headers) +install(TARGETS github-mirror DESTINATION bin) # Compile Options foreach (compiler_flag ${custom_compiler_flags}) CHECK_C_COMPILER_FLAG(${compiler_flag} "FLAG_SUPPORTED_${current_variable}") if (FLAG_SUPPORTED_${current_variable}) message(STATUS "Compiler flag ${compiler_flag} is supported") - target_compile_options(github_mirror PRIVATE ${compiler_flag}) + target_compile_options(github-mirror PRIVATE ${compiler_flag}) else () message(WARNING "Compiler flag ${compiler_flag} is not supported") endif () @@ -98,7 +98,7 @@ endforeach () # Debug and Sanitizers is not empty if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND SANITIZERS) - target_link_options(github_mirror PRIVATE "-fsanitize=${SANITIZERS}") + target_link_options(github-mirror PRIVATE "-fsanitize=${SANITIZERS}") endif () # Manpages @@ -130,7 +130,7 @@ add_test(NAME test_config COMMAND test_config) # Packaging include(InstallRequiredSystemLibraries) -set(CPACK_PACKAGE_NAME "github_mirror") +set(CPACK_PACKAGE_NAME "github-mirror") set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_PACKAGE_CONTACT "ansg191@anshulg.com") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Anshul Gupta") diff --git a/man/github_mirror.1 b/man/github_mirror.1 index 08f7e2a..4d7151b 100644 --- a/man/github_mirror.1 +++ b/man/github_mirror.1 @@ -1,9 +1,9 @@ .Dd 4/28/2025 -.Dt GITHUB_MIRROR 1 +.Dt GITHUB-MIRROR 1 .Os Darwin .Sh NAME -.Nm github_mirror +.Nm github-mirror .Nm github-mirror .Nd Mirror GitHub repositories to a local directory @@ -30,17 +30,17 @@ Load configuration from the specified file. By default it will search in the following locations: .Bl -tag -width Ds .It Pa config.ini -.It Pa github_mirror.conf -.It Pa /usr/local/github_mirror/config.ini -.It Pa /usr/local/github_mirror.conf -.It Pa /usr/local/etc/github_mirror/config.ini -.It Pa /usr/local/etc/github_mirror.conf -.It Pa /etc/github_mirror/config.ini -.It Pa /etc/github_mirror.conf +.It Pa github-mirror.conf +.It Pa /usr/local/github-mirror/config.ini +.It Pa /usr/local/github-mirror.conf +.It Pa /usr/local/etc/github-mirror/config.ini +.It Pa /usr/local/etc/github-mirror.conf +.It Pa /etc/github-mirror/config.ini +.It Pa /etc/github-mirror.conf .El See -.Xr github_mirror.conf 5 +.Xr github-mirror.conf 5 for more details on the configuration file format. .It Fl h , Fl -help @@ -69,7 +69,7 @@ An error occurred. .El .Sh SEE ALSO -.Xr github_mirror.conf 5 , +.Xr github-mirror.conf 5 , .Xr git 1 .Sh AUTHORS diff --git a/man/github_mirror.conf.5 b/man/github_mirror.conf.5 index e4db4ff..9900ab9 100644 --- a/man/github_mirror.conf.5 +++ b/man/github_mirror.conf.5 @@ -1,10 +1,10 @@ .Dd 4/28/2025 -.Dt GITHUB_MIRROR.CONF 5 +.Dt GITHUB-MIRROR.CONF 5 .Os Darwin .Sh NAME -.Nm github_mirror.conf -.Nd Configuration file for github_mirror +.Nm github-mirror.conf +.Nd Configuration file for github-mirror .Sh SYNOPSIS .Nm @@ -12,7 +12,7 @@ .Sh DESCRIPTION The .Nm -file contains options used to specify github_mirror configuration. +file contains options used to specify github-mirror configuration. .Pp The file is in a INI format, where each line contains an option field and a @@ -48,7 +48,7 @@ This can either be a literal token or a path to a file containing the token. .It Cm user_agent The User-Agent string to use. The default is -.Dq Cm github_mirror/VERSION +.Dq Cm github-mirror/VERSION where VERSION is the version of the program. .It Cm owner @@ -75,13 +75,13 @@ The base directory to mirror repositories into. The default is .El .Sh FILES -.Bl -tag -width "/etc/github_mirror.conf" -compact -.It Pa /etc/github_mirror.conf +.Bl -tag -width "/etc/github-mirror.conf" -compact +.It Pa /etc/github-mirror.conf The .Nm configuration file. .El .Sh SEE ALSO -.Xr github_mirror 1 , +.Xr github-mirror 1 , .Xr git 1 diff --git a/src/config.c b/src/config.c index 23afac2..1556e68 100644 --- a/src/config.c +++ b/src/config.c @@ -17,13 +17,13 @@ const char *config_locations[] = { "config.ini", - "github_mirror.conf", - "/usr/local/github_mirror/config.ini", - "/usr/local/github_mirror.conf", - "/usr/local/etc/github_mirror/config.ini", - "/usr/local/etc/github_mirror.conf", - "/etc/github_mirror/config.ini", - "/etc/github_mirror.conf", + "github-mirror.conf", + "/usr/local/github-mirror/config.ini", + "/usr/local/github-mirror.conf", + "/usr/local/etc/github-mirror/config.ini", + "/usr/local/etc/github-mirror.conf", + "/etc/github-mirror/config.ini", + "/etc/github-mirror.conf", NULL, }; diff --git a/src/config.h b/src/config.h index aacf417..eb133b4 100644 --- a/src/config.h +++ b/src/config.h @@ -8,7 +8,7 @@ #include <stdlib.h> #define GH_DEFAULT_ENDPOINT "https://api.github.com/graphql" -#define GH_DEFAULT_USER_AGENT "github_mirror/" GITHUB_MIRROR_VERSION +#define GH_DEFAULT_USER_AGENT "github-mirror/" GITHUB_MIRROR_VERSION extern const char *config_locations[]; @@ -40,7 +40,7 @@ static int load_config(int argc, char **argv, struct config **cfg_out) quiet = 1; break; case 'v': - fprintf(stderr, "github_mirror v%s\n", + fprintf(stderr, "github-mirror v%s\n", GITHUB_MIRROR_VERSION); return 0; default: |