cmd::desktop_entry: Some TODOs

This commit is contained in:
Sasha Koshka 2024-10-22 15:52:07 -04:00
parent ba330e9e0d
commit fa4c34bd53

View File

@ -11,7 +11,7 @@ export fn main() void = {
const cmd = getopt::parse( const cmd = getopt::parse(
os::args, os::args,
"parse and display desktop entries", "parse and display desktop entries",
('l', "locale", "the name of the locale to use"), ('l', "locale", "the name of the locale to use"), // FIXME not working
('a', "action", "display a specific action"), ('a', "action", "display a specific action"),
"file"); "file");
defer getopt::finish(&cmd); defer getopt::finish(&cmd);
@ -38,6 +38,7 @@ export fn main() void = {
os::exit(os::status::FAILURE); os::exit(os::status::FAILURE);
}; };
// TODO put in function and handle errors here
let file = os::open(file_name)!; let file = os::open(file_name)!;
defer io::close(file)!; defer io::close(file)!;
let file = desktop_entry::parse(file)!; let file = desktop_entry::parse(file)!;
@ -74,7 +75,8 @@ fn print_file (file: desktop_entry::file, local: locale::locale) (void | desktop
case let icon: str => if (icon != "") fmt::printf("Icon={}\n", icon)?; case let icon: str => if (icon != "") fmt::printf("Icon={}\n", icon)?;
case void => void; case void => void;
}; };
// TODO // TODO all other keys
// https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html
}; };
fn print_action (file: desktop_entry::file, local: locale::locale, key: str) (void | desktop_entry::error) = { fn print_action (file: desktop_entry::file, local: locale::locale, key: str) (void | desktop_entry::error) = {