Skip to content

Commit

Permalink
gui: add --path
Browse files Browse the repository at this point in the history
  • Loading branch information
hinto-janai committed Jun 27, 2023
1 parent 1c3fa15 commit f963de4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ Options:
skip backwards, this will reset the current song to
the 1st in the queue.
--path
Print the PATH used by Festival
All data saved by Festival is saved here.
For more information, see:
https://github.com/hinto-janai/festival/tree/main/gui#Disk
--metadata
Print JSON metadata about the current `Collection` on disk
Expand Down Expand Up @@ -169,14 +176,14 @@ Options:
--delete
Delete all Festival files that are currently on disk
This includes:
This deletes the entire `GUI` Festival folder, which contains:
- The `Collection`
- `GUI` settings (sort methods, color, etc)
- `GUI` state (currently selected album/artist, etc)
- Audio state (currently playing song, queue, etc)
- Cached images (found in local OS cache folder)
- Cached images for the OS media controls
The PATH(s) deleted will be printed on success.
The PATH deleted will be printed on success.
--log-level <OFF|ERROR|INFO|WARN|DEBUG|TRACE>
Set filter level for console logs
Expand All @@ -191,7 +198,7 @@ Options:
```

# Disk
Festival saves all of its important files within the "OS data" directory.
Festival saves all of its files within the "OS data" directory.

You can delete this folder to reset Festival's state/settings and the Collection, or more easily, just run:
```bash
Expand Down
17 changes: 17 additions & 0 deletions gui/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ pub struct Cli {
/// the 1st in the queue.
back: Option<usize>,

#[arg(long, verbatim_doc_comment)]
/// Print the PATH used by Festival
///
/// All data saved by Festival is saved here.
/// For more information, see:
/// https://github.com/hinto-janai/festival/tree/main/gui#Disk
path: bool,

#[arg(long, verbatim_doc_comment)]
/// Print JSON metadata about the current `Collection` on disk
///
Expand Down Expand Up @@ -229,6 +237,15 @@ impl Cli {
if let Some(skip) = self.skip { handle(Skip(skip).save()) }
if let Some(back) = self.back { handle(Back(back).save()) }

// Path.
if self.path {
// SAFETY:
// If we can't get a PATH, `panic!()`'ing is fine.
let p = crate::data::State::sub_dir_parent_path().unwrap();
println!("{}", p.display());
exit(0);
}

// Delete.
if self.delete {
// SAFETY:
Expand Down

0 comments on commit f963de4

Please # to comment.