Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kobaltcore committed Feb 2, 2022
1 parent bd3b91d commit 6cb7ba9
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 6 deletions.
143 changes: 139 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,142 @@
# Diadog
# diadog

> Diadog, your loyal dialog companion. Binaries to open native file dialogs on multiple platforms.
> diadog, your loyal file dialog companion. Binaries to open native file dialogs on multiple platforms.
Linux: libgtk-3-dev libdbus-1-dev
diadog is a collection of pre-built binaries for the most common desktop platforms which enables you to open native file dialogs easily and in a standardized manner, and receive the paths selected by the user back as a string.

Windows: ole32.lib uuid.lib
This toolkit supports multiple forms of file dialogs, namely:
- Selecting a single file
- Selecting multiple files
- Selecting folders
- Selecting an output file

All file-related actions can optionally be supplied with a set of allowed file extensions to restrict the user input.

diadog supports the following platforms:
- Windows x64
- macOS x64
- Linux x64 (with GTK)

Support for more platform is planned, specifically:
- Windows x32
- macOS arm64
- Linux x64 (no GTK)

## Samples
```bash
$ dopen single
> "/Users/test/Documents/file.pdf"
```

```bash
$ dopen many
> "/Users/test/Documents/file1.pdf"
> "/Users/test/Documents/file2.pdf"
> "/Users/test/Documents/file3.pdf"
```

```bash
$ dsave single
> "/Users/test/Documents/out.txt"
```

## Usage

### `dopen`
```bash
Usage is like:
dopen {SUBCMD} [subcommand-opts & args]
where subcommand syntaxes are as follows:

single [optional-params]
Select a single file.
Options:
-p=, --path= string "" The path to open by default.
--packages= strings {} The display name of a set of file types to match.
-f=, --filters= strings {} The file types to match, in the order of the specified packages.

many [optional-params]
Select one or more files.
Options:
-p=, --path= string "" The path to open by default.
--packages= strings {} The display name of a set of file types to match.
-f=, --filters= strings {} The file types to match, in the order of the specified packages.

folder [optional-params]
Select a folder.
Options:
-p=, --path= string "" The path to open by default.
```

### `dsave`
```bash
Usage is like:
dsave {SUBCMD} [subcommand-opts & args]
where subcommand syntaxes are as follows:

single [optional-params]
Save to a single file.
Options:
-n=, --name= string "" The name to use by default.
-p=, --path= string "" The path to open by default.
--packages= strings {} The display name of a set of file types to match.
-f=, --filters= strings {} The file types to match, in the order of the specified packages.
```

### Notes
When supplying multiple filters, the first one will be used as the default file extension. For example, if you supply filters for two distinct packages for ZIP's and JPG's, in that order, the default file extension will be `.zip`.

### Example Invocations

#### `dopen`
##### Setting a custom start path
```bash
dopen single --path="/Users/test/Documents"
```

##### Setting valid file extensions
```bash
dopen single --pack="Image" --filter="jpg,jpeg"
```

##### Setting multiple valid file extensions
```bash
dopen single --pack="Image" --filter="jpg,jpeg" --pack="Archices" --filter="zip,tar,gz,rar"
```

#### `dsave`
##### Setting a custom start path
```bash
dsave single --path="/Users/test/Documents"
```

##### Setting valid file extensions
```bash
dsave single --pack="Image" --filter="jpg,jpeg"
```

##### Setting multiple valid file extensions
```bash
dsave single --pack="Image" --filter="jpg,jpeg" --pack="Archices" --filter="zip,tar,gz,rar"
```

## Building
Building diadog

### Linux
Ensure that `libgtk-3-dev` is installed.
```bash
nimble build_all_linux
```

### Windows
The recommended way is to cross-compile from Linux via MingW. No extra dependencies are required.
```bash
nimble build_all_windows
```

### macOS
No extra dependencies are required.
```bash
nimble build_all_macos
```
2 changes: 0 additions & 2 deletions src/dopen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import wrapper

proc single*(path = "", packages: seq[string] = @[], filters: seq[string] = @[]) =
## Select a single file.
# Example:
# open single --pack="Scenario_Archive" -f="zip" --pack="Image" -f="jpg,jpeg"
if packages.len != filters.len:
echo "Please specify a matching number of package names and filters."
quit(1)
Expand Down

0 comments on commit 6cb7ba9

Please sign in to comment.