Skip to content

Commit a395e76

Browse files
committed
add single header version
1 parent 9063b94 commit a395e76

5 files changed

Lines changed: 502 additions & 77 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.16)
2-
project(CLI-Autocomplete VERSION 1.0.1)
2+
project(CLI-Autocomplete VERSION 1.0.2)
33

44
set(CMAKE_CXX_STANDARD 17)
55

@@ -24,4 +24,4 @@ if (WIN32)
2424
elseif (UNIX)
2525
set_target_properties(example PROPERTIES
2626
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/example/${CMAKE_BUILD_TYPE}/")
27-
endif()
27+
endif()

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Cross-platform flexible autocomplete library for your CLI applications
1515
- Write your own autocomplete rules
1616
- Setup your own highlight colors
1717
- Required `C++17`
18+
- Single header version of the library
19+
- `static` and `dynamic` versions of the library
1820

1921
### Config Example
2022
1. After `git` may follow: `config`, `init`, `clone`

include/autocomplete.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ SHARED_LIB short cursor_y_pos();
104104
*/
105105
SHARED_LIB void goto_xy(short x, short y);
106106

107+
/**
108+
* Remove extra spaces to the left and right of the string.
109+
*
110+
* @param str Source string.
111+
* @return A new line equal to the original one without spaces on the left and right.
112+
*/
113+
SHARED_LIB std::string trim(std::string_view str);
114+
115+
/**
116+
* Parse config file to dictionary.
117+
*
118+
* @param file_path The path to the configuration file.
119+
* @return Tuple of dictionary with autocomplete rules, status of parsing and message.
120+
*/
121+
SHARED_LIB std::tuple<Dictionary, bool, std::string> parse_config_file(const std::string& file_path);
122+
107123
/**
108124
* Get the minimum of two numbers.
109125
*
@@ -174,7 +190,7 @@ SHARED_LIB std::pair<size_t, std::string> get_penult_word(std::string_view str);
174190
* preceding before phrase, start position of last word.
175191
*/
176192
SHARED_LIB std::tuple<std::string, std::string, std::string, size_t>
177-
get_prediction (std::string_view buffer, Dictionary& dict, size_t number, std::string_view optional_brackets);
193+
get_prediction(std::string_view buffer, Dictionary& dict, size_t number, std::string_view optional_brackets);
178194

179195
/**
180196
* Printing user input with prompts.
@@ -217,20 +233,4 @@ SHARED_LIB std::string input(Dictionary& dict, std::string_view line_title = "",
217233
std::string title_color = "92", std::string predict_color = "90", std::string default_color = "0");
218234
#endif
219235

220-
/**
221-
* Remove extra spaces to the left and right of the string.
222-
*
223-
* @param str Source string.
224-
* @return A new line equal to the original one without spaces on the left and right.
225-
*/
226-
SHARED_LIB std::string trim(std::string_view str);
227-
228-
/**
229-
* Parse config file to dictionary.
230-
*
231-
* @param file_path The path to the configuration file.
232-
* @return Tuple of dictionary with autocomplete rules, status of parsing and message.
233-
*/
234-
SHARED_LIB std::tuple<Dictionary, bool, std::string> parse_config_file(const std::string& file_path);
235-
236236
#endif //CLI_AUTOCOMPLETE_AUTOCOMPLETE_H

0 commit comments

Comments
 (0)