Skip to content

Commit 0b13fd0

Browse files
authored
Merge pull request #336 from rsteube/add-nano
added nano
2 parents 3749f92 + 9e27ba2 commit 0b13fd0

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

completers/nano_completer/cmd/root.go

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package cmd
2+
3+
import (
4+
"github.com/rsteube/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var rootCmd = &cobra.Command{
9+
Use: "nano",
10+
Short: "",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func Execute() error {
15+
return rootCmd.Execute()
16+
}
17+
func init() {
18+
carapace.Gen(rootCmd).Standalone()
19+
20+
rootCmd.Flags().BoolP("afterends", "y", false, "Make Ctrl+Right stop at word ends")
21+
rootCmd.Flags().BoolP("atblanks", "a", false, "When soft-wrapping, do it at whitespace")
22+
rootCmd.Flags().BoolP("autoindent", "i", false, "Automatically indent new lines")
23+
rootCmd.Flags().BoolP("backup", "B", false, "Save backups of existing files")
24+
rootCmd.Flags().StringP("backupdir", "C", "", "Directory for saving unique backup files")
25+
rootCmd.Flags().BoolP("boldtext", "D", false, "Use bold instead of reverse video text")
26+
rootCmd.Flags().BoolP("bookstyle", "O", false, "Leading whitespace means new paragraph")
27+
rootCmd.Flags().BoolP("breaklonglines", "b", false, "Automatically hard-wrap overlong lines")
28+
rootCmd.Flags().BoolP("constantshow", "c", false, "Constantly show cursor position")
29+
rootCmd.Flags().BoolP("cutfromcursor", "k", false, "Cut from cursor to end of line")
30+
rootCmd.Flags().BoolP("emptyline", "e", false, "Keep the line below the title bar empty")
31+
rootCmd.Flags().StringP("fill", "r", "", "Set width for hard-wrap and justify")
32+
rootCmd.Flags().StringP("guidestripe", "J", "", "Show a guiding bar at this column")
33+
rootCmd.Flags().BoolP("help", "h", false, "Show this help text and exit")
34+
rootCmd.Flags().BoolP("historylog", "H", false, "Log & read search/replace string history")
35+
rootCmd.Flags().BoolP("ignorercfiles", "I", false, "Don't look at nanorc files")
36+
rootCmd.Flags().BoolP("indicator", "q", false, "Show a position+portion indicator")
37+
rootCmd.Flags().BoolP("jumpyscrolling", "j", false, "Scroll per half-screen, not per line")
38+
rootCmd.Flags().BoolP("linenumbers", "l", false, "Show line numbers in front of the text")
39+
rootCmd.Flags().BoolP("locking", "G", false, "Use (vim-style) lock files")
40+
rootCmd.Flags().BoolP("magic", "!", false, "Also try magic to determine syntax")
41+
rootCmd.Flags().BoolP("minibar", "_", false, "Show a feedback bar at the bottom")
42+
rootCmd.Flags().BoolP("mouse", "m", false, "Enable the use of the mouse")
43+
rootCmd.Flags().BoolP("multibuffer", "F", false, "Read a file into a new buffer by default")
44+
rootCmd.Flags().BoolP("noconvert", "N", false, "Don't convert files from DOS/Mac format")
45+
rootCmd.Flags().BoolP("nohelp", "x", false, "Don't show the two help lines")
46+
rootCmd.Flags().BoolP("nonewlines", "L", false, "Don't add an automatic newline")
47+
rootCmd.Flags().BoolP("noread", "n", false, "Do not read the file (only write it)")
48+
rootCmd.Flags().BoolP("nowrap", "w", false, "Don't hard-wrap long lines [default]")
49+
rootCmd.Flags().StringP("operatingdir", "o", "", "Set operating directory")
50+
rootCmd.Flags().BoolP("positionlog", "P", false, "Log & read location of cursor position")
51+
rootCmd.Flags().BoolP("preserve", "p", false, "Preserve XON (^Q) and XOFF (^S) keys")
52+
rootCmd.Flags().BoolP("quickblank", "U", false, "Wipe status bar upon next keystroke")
53+
rootCmd.Flags().StringP("quotestr", "Q", "", "Regular expression to match quoting")
54+
rootCmd.Flags().BoolP("rawsequences", "K", false, "Fix numeric keypad key confusion problem")
55+
rootCmd.Flags().StringP("rcfile", "f", "", "Use only this file for configuring nano")
56+
rootCmd.Flags().BoolP("rebinddelete", "d", false, "Fix Backspace/Delete confusion problem")
57+
rootCmd.Flags().BoolP("restricted", "R", false, "Restrict access to the filesystem")
58+
rootCmd.Flags().BoolP("saveonexit", "t", false, "Save changes on exit, don't prompt")
59+
rootCmd.Flags().BoolP("showcursor", "g", false, "Show cursor in file browser & help text")
60+
rootCmd.Flags().BoolP("smarthome", "A", false, "Enable smart home key")
61+
rootCmd.Flags().BoolP("softwrap", "S", false, "Display overlong lines on multiple rows")
62+
rootCmd.Flags().StringP("speller", "s", "", "Use this alternative spell checker")
63+
rootCmd.Flags().BoolP("stateflags", "%", false, "Show some states on the title bar")
64+
rootCmd.Flags().BoolP("suspendable", "z", false, "Enable suspension")
65+
rootCmd.Flags().StringP("syntax", "Y", "", "Syntax definition to use for coloring")
66+
rootCmd.Flags().StringP("tabsize", "T", "", "Make a tab this number of columns wide")
67+
rootCmd.Flags().BoolP("tabstospaces", "E", false, "Convert typed tabs to spaces")
68+
rootCmd.Flags().BoolP("trimblanks", "M", false, "Trim tail spaces when hard-wrapping")
69+
rootCmd.Flags().BoolP("unix", "u", false, "Save a file by default in Unix format")
70+
rootCmd.Flags().BoolP("version", "V", false, "Print version information and exit")
71+
rootCmd.Flags().BoolP("view", "v", false, "View mode (read-only)")
72+
rootCmd.Flags().BoolP("wordbounds", "W", false, "Detect word boundaries more accurately")
73+
rootCmd.Flags().StringP("wordchars", "X", "", "Which other characters are word parts")
74+
rootCmd.Flags().BoolP("zap", "Z", false, "Let Bsp and Del erase a marked region")
75+
76+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
77+
"backupdir": carapace.ActionDirectories(),
78+
"operatingdir": carapace.ActionDirectories(),
79+
"rcfile": carapace.ActionFiles(),
80+
"speller": carapace.ActionFiles(),
81+
})
82+
83+
carapace.Gen(rootCmd).PositionalAnyCompletion(
84+
carapace.ActionFiles(),
85+
)
86+
}

completers/nano_completer/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/rsteube/carapace-bin/completers/nano_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)