2020-01-10 07:00:38 -05:00
|
|
|
package zenity_test
|
2019-12-11 05:29:31 -05:00
|
|
|
|
2020-01-10 07:00:38 -05:00
|
|
|
import "github.com/ncruces/zenity"
|
2019-12-11 05:29:31 -05:00
|
|
|
|
2019-12-28 10:34:38 -05:00
|
|
|
const defaultPath = ""
|
2020-01-10 07:00:38 -05:00
|
|
|
const defaultName = ""
|
|
|
|
|
|
|
|
func ExampleSelectFile() {
|
|
|
|
zenity.SelectFile(
|
|
|
|
zenity.Filename(defaultPath),
|
|
|
|
zenity.FileFilters{
|
|
|
|
{"Go files", []string{"*.go"}},
|
|
|
|
{"Web files", []string{"*.html", "*.js", "*.css"}},
|
|
|
|
{"Image files", []string{"*.png", "*.gif", "*.ico", "*.jpg", "*.webp"}},
|
|
|
|
}.New())
|
|
|
|
// Output:
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
|
2020-01-10 07:00:38 -05:00
|
|
|
func ExampleSelectFileMutiple() {
|
|
|
|
zenity.SelectFileMutiple(
|
|
|
|
zenity.Filename(defaultPath),
|
|
|
|
zenity.FileFilters{
|
|
|
|
{"Go files", []string{"*.go"}},
|
|
|
|
{"Web files", []string{"*.html", "*.js", "*.css"}},
|
|
|
|
{"Image files", []string{"*.png", "*.gif", "*.ico", "*.jpg", "*.webp"}},
|
|
|
|
}.New())
|
|
|
|
// Output:
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
|
2020-01-10 07:00:38 -05:00
|
|
|
func ExampleSelectFileSave() {
|
|
|
|
zenity.SelectFileSave(
|
|
|
|
zenity.ConfirmOverwrite,
|
|
|
|
zenity.Filename(defaultName),
|
|
|
|
zenity.FileFilters{
|
|
|
|
{"Go files", []string{"*.go"}},
|
|
|
|
{"Web files", []string{"*.html", "*.js", "*.css"}},
|
|
|
|
{"Image files", []string{"*.png", "*.gif", "*.ico", "*.jpg", "*.webp"}},
|
|
|
|
}.New())
|
|
|
|
// Output:
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
|
2020-01-10 07:00:38 -05:00
|
|
|
func ExampleSelectFile_directory() {
|
|
|
|
zenity.SelectFile(
|
|
|
|
zenity.Filename(defaultPath),
|
|
|
|
zenity.Directory)
|
|
|
|
// Output:
|
2020-01-09 20:46:53 -05:00
|
|
|
}
|
|
|
|
|
2020-01-10 07:00:38 -05:00
|
|
|
func ExampleSelectFileMutiple_directory() {
|
|
|
|
zenity.SelectFileMutiple(
|
|
|
|
zenity.Filename(defaultPath),
|
|
|
|
zenity.Directory)
|
|
|
|
// Output:
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|