Shell: Use starts_with() in expand_parameters
This reads a little nicer, and makes us care less about an empty String
This commit is contained in:
parent
d806dfe801
commit
1ef3d4af69
Notes:
sideshowbarker
2024-07-19 08:11:35 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/1ef3d4af694 Pull-request: https://github.com/SerenityOS/serenity/pull/1496
1 changed files with 1 additions and 2 deletions
|
@ -700,8 +700,7 @@ static Vector<String> expand_globs(const StringView& path, const StringView& bas
|
|||
|
||||
static Vector<String> expand_parameters(const StringView& param)
|
||||
{
|
||||
bool is_variable = param.length() > 1 && param[0] == '$';
|
||||
if (!is_variable)
|
||||
if (!param.starts_with('$'))
|
||||
return { param };
|
||||
|
||||
String variable_name = String(param.substring_view(1, param.length() - 1));
|
||||
|
|
Loading…
Add table
Reference in a new issue