Skip to content

Commit

Permalink
Merge pull request #1421 from rsteube/add-imv
Browse files Browse the repository at this point in the history
added imv
  • Loading branch information
rsteube authored Nov 26, 2022
2 parents 62f6a8c + 054575d commit 2def4e6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
49 changes: 49 additions & 0 deletions completers/imv_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/color"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "imv",
Short: "Image viewer for X11 and Wayland",
Long: "https://git.sr.ht/~exec64/imv/",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().StringS("b", "b", "", "Set the background colour")
rootCmd.Flags().StringS("c", "c", "", "Specify a command to be run on launch")
rootCmd.Flags().BoolS("d", "d", false, "Start with overlay visible")
rootCmd.Flags().BoolS("f", "f", false, "Start fullscreen")
rootCmd.Flags().BoolS("h", "h", false, "Show help message and quit")
rootCmd.Flags().BoolS("l", "l", false, "List open files to stdout at exit")
rootCmd.Flags().StringS("n", "n", "", "Start with the given path, or index selected")
rootCmd.Flags().BoolS("r", "r", false, "Load directories recursively")
rootCmd.Flags().StringS("s", "s", "", "Set scaling mode to use")
rootCmd.Flags().StringS("t", "t", "", "Start in slideshow mode, with each image shown for the given number of seconds")
rootCmd.Flags().StringS("u", "u", "", "Set upscaling method used by imv")
rootCmd.Flags().BoolS("v", "v", false, "Show version and quit")
rootCmd.Flags().BoolS("x", "x", false, "Disable looping of input paths")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"b": carapace.Batch(
color.ActionHexColors(),
carapace.ActionValuesDescribed("checks", "chequered background"),
).ToA(),
"n": carapace.ActionFiles(),
"s": carapace.ActionValues("none", "shrink", "full", "crop"),
"u": carapace.ActionValues("linear", "nearest_neighbour"),
})

carapace.Gen(rootCmd).PositionalAnyCompletion(
carapace.ActionFiles(),
)
}
7 changes: 7 additions & 0 deletions completers/imv_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/imv_completer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit 2def4e6

Please sign in to comment.