johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.26k stars 256 forks source link

Open file through CLI? #1249

Closed celsobenedetti closed 4 months ago

celsobenedetti commented 4 months ago

Question:

I've installed Foliate through Flatpak, and I'm failing to open files from the CLI. I've tried the following approaches, and all result in the app opening, but "Book cannot be opened - file not found".

flatpak run com.github.johnfactotum.Foliate "/home/me/book.epub"
flatpak run --file-forwarding   com.github.johnfactotum.Foliate "/home/me/book.epub"
echo "/home/me/book.epub" | xargs flatpak run  --file-forwarding  com.github.johnfactotum.Foliate
echo "/home/me/book.epub" | xargs flatpak run com.github.johnfactotum.Foliate 

Thank you!

Version:

johnfactotum commented 4 months ago

From the documentation:

--file-forwarding

If this option is specified, the remaining arguments are scanned, and all arguments that are enclosed between a pair of @@ arguments are interpreted as file paths, exported in the document store, and passed to the command in the form of the resulting document path. Arguments between @@u and @@ are considered uris, and any file: uris are exported. The exports are non-persistent and with read and write permissions for the application.

So

flatpak run --file-forwarding com.github.johnfactotum.Foliate @@ "/home/me/book.epub" @@
celsobenedetti commented 4 months ago

Works great. Thank you for the awesome tool.