Skip to content

Commit 5196e0c

Browse files
committed
rename method
1 parent 70c4ce0 commit 5196e0c

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/clargs/parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void parser::parse_long_key_argument(std::string_view arg)
253253
} else if (arg.size() == 2) {
254254
ASSERT(arg == "--")
255255
// default handling of '--' argument is disabling key arguments parsing
256-
this->enable_key_parsing(false);
256+
this->set_key_parsing(false);
257257
return;
258258
}
259259
}

src/clargs/parser.hpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class parser
166166
* After handling the subcommand, the parsing will be stopped and the parse() function will return.
167167
* In the subcommand handler the user can set up a new parser instance and continue parsing
168168
* arguments of the subcommand.
169-
* Subcommand is only handled if key parsing is enabled, which is default (see enable_key_parsing()).
169+
* Subcommand is only handled if key parsing is enabled, which is default (see set_key_parsing()).
170170
* @param subcommand_handler - handler callback for subcommand.
171171
*/
172172
void add(
@@ -186,11 +186,17 @@ class parser
186186
* It is ok to call this function from within the arguments handling callback functions.
187187
* @param enable - if true, key arguments parsing will be enabled, otherwise - disabled.
188188
*/
189-
void enable_key_parsing(bool enable) noexcept
189+
void set_key_parsing(bool enable) noexcept
190190
{
191191
this->is_key_parsing_enabled = enable;
192192
}
193193

194+
[[deprecated("use set_key_parsing(bool)")]]
195+
void enable_key_parsing(bool enable) noexcept
196+
{
197+
this->set_key_parsing(enable);
198+
}
199+
194200
/**
195201
* @brief Parse command line arguments.
196202
* Parses the command line arguments.
@@ -212,7 +218,7 @@ class parser
212218

213219
/**
214220
* @brief Stop parsing.
215-
* Can be called from within arguement handler to stop further arguments parsing.
221+
* Can be called from within argument handler to stop further arguments parsing.
216222
*/
217223
void stop();
218224

tests/unit/src/basic.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const tst::set set("basic", [](tst::suite& suite){
9191
p.add('a', "aaa", "description", [&a, &p](){
9292
++a;
9393
if(a == 3){
94-
p.enable_key_parsing(false);
94+
p.set_key_parsing(false);
9595
}
9696
});
9797

@@ -121,7 +121,7 @@ const tst::set set("basic", [](tst::suite& suite){
121121
p.add('a', "aaa", "description", [&a, &p](){
122122
++a;
123123
if(a == 2){
124-
p.enable_key_parsing(false);
124+
p.set_key_parsing(false);
125125
}
126126
});
127127

@@ -139,7 +139,7 @@ const tst::set set("basic", [](tst::suite& suite){
139139
p.add([&res, &p](std::string_view str){
140140
res.emplace_back(str);
141141
if(res.size() == 3){
142-
p.enable_key_parsing(true);
142+
p.set_key_parsing(true);
143143
}
144144
});
145145

@@ -443,7 +443,7 @@ const tst::set set("basic", [](tst::suite& suite){
443443
sp.parse(args);
444444
});
445445

446-
p.enable_key_parsing(false);
446+
p.set_key_parsing(false);
447447

448448
p.parse(utki::make_span(args));
449449

tool-configs

0 commit comments

Comments
 (0)