[Helper] Quick and dirty string replacer with optional keys block.
First (quick and dirty) version of a more advanced key replacer where sets of text are only outputted if the contained key matches.
This commit is contained in:
@@ -336,5 +336,21 @@ void parse_ranges ( char *input, rofi_range_pair **list, unsigned int *length );
|
||||
* @param filter
|
||||
*/
|
||||
void rofi_output_formatted_line ( const char *format, const char *string, int selected_line, const char *filter );
|
||||
|
||||
|
||||
/**
|
||||
* @param string The string with elements to be replaced
|
||||
* @param ... Set of {key}, value that will be replaced, terminated by a NULL
|
||||
*
|
||||
* Items {key} are replaced by the value if '{key}' is passed as key/value pair, otherwise removed from string.
|
||||
* If the {key} is in between [] all the text between [] are removed if {key}
|
||||
* is not found. Otherwise key is replaced and [ & ] removed.
|
||||
*
|
||||
* This allows for optional replacement, f.e. '{ssh-client} [-t {title}] -e
|
||||
* "{cmd}"' the '-t {title}' is only there if {title} is set.
|
||||
*
|
||||
* @returns a new string with the keys replaced.
|
||||
*/
|
||||
char *helper_string_replace_if_exists ( char * string, ... );
|
||||
G_END_DECLS
|
||||
#endif // ROFI_HELPER_H
|
||||
|
Reference in New Issue
Block a user