mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
Shell: Replace uses of JsonObject::get_deprecated()/get_ptr()
This commit is contained in:
parent
ba51e2dd3f
commit
95b1cf2dcd
Notes:
sideshowbarker
2024-07-17 18:38:54 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/95b1cf2dcd Pull-request: https://github.com/SerenityOS/serenity/pull/17185
@ -1880,32 +1880,32 @@ ErrorOr<Vector<Line::CompletionSuggestion>> Shell::complete_via_program_itself(s
|
||||
auto parsed = parsed_result.release_value();
|
||||
if (parsed.is_object()) {
|
||||
auto& object = parsed.as_object();
|
||||
auto kind = object.get_deprecated("kind"sv).as_string_or("plain");
|
||||
auto kind = object.get_deprecated_string("kind"sv).value_or("plain");
|
||||
if (kind == "path") {
|
||||
auto base = object.get_deprecated("base"sv).as_string_or("");
|
||||
auto part = object.get_deprecated("part"sv).as_string_or("");
|
||||
auto executable_only = object.get_deprecated("executable_only"sv).to_bool(false) ? ExecutableOnly::Yes : ExecutableOnly::No;
|
||||
auto base = object.get_deprecated_string("base"sv).value_or("");
|
||||
auto part = object.get_deprecated_string("part"sv).value_or("");
|
||||
auto executable_only = object.get_bool("executable_only"sv).value_or(false) ? ExecutableOnly::Yes : ExecutableOnly::No;
|
||||
suggestions.extend(complete_path(base, part, part.length(), executable_only, nullptr, nullptr));
|
||||
} else if (kind == "program") {
|
||||
auto name = object.get_deprecated("name"sv).as_string_or("");
|
||||
auto name = object.get_deprecated_string("name"sv).value_or("");
|
||||
suggestions.extend(complete_program_name(name, name.length()));
|
||||
} else if (kind == "proxy") {
|
||||
if (m_completion_stack_info.size_free() < 4 * KiB) {
|
||||
dbgln("Not enough stack space, recursion?");
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
auto argv = object.get_deprecated("argv"sv).as_string_or("");
|
||||
auto argv = object.get_deprecated_string("argv"sv).value_or("");
|
||||
dbgln("Proxy completion for {}", argv);
|
||||
suggestions.extend(complete(argv));
|
||||
} else if (kind == "plain") {
|
||||
Line::CompletionSuggestion suggestion {
|
||||
object.get_deprecated("completion"sv).as_string_or(""),
|
||||
object.get_deprecated("trailing_trivia"sv).as_string_or(""),
|
||||
object.get_deprecated("display_trivia"sv).as_string_or(""),
|
||||
object.get_deprecated_string("completion"sv).value_or(""),
|
||||
object.get_deprecated_string("trailing_trivia"sv).value_or(""),
|
||||
object.get_deprecated_string("display_trivia"sv).value_or(""),
|
||||
};
|
||||
suggestion.static_offset = object.get_deprecated("static_offset"sv).to_u64(0);
|
||||
suggestion.invariant_offset = object.get_deprecated("invariant_offset"sv).to_u64(0);
|
||||
suggestion.allow_commit_without_listing = object.get_deprecated("allow_commit_without_listing"sv).to_bool(true);
|
||||
suggestion.static_offset = object.get_u64("static_offset"sv).value_or(0);
|
||||
suggestion.invariant_offset = object.get_u64("invariant_offset"sv).value_or(0);
|
||||
suggestion.allow_commit_without_listing = object.get_bool("allow_commit_without_listing"sv).value_or(true);
|
||||
suggestions.append(move(suggestion));
|
||||
} else {
|
||||
dbgln("LibLine: Unhandled completion kind: {}", kind);
|
||||
|
Loading…
Reference in New Issue
Block a user