chore(commands): more commands for suggestions (#10)
## What's new - color completion message command green https://github.com/versenilvis/IRIS/pull/10/commits/6e141f5e6909fad1ec42725cce38d51729acf399 - new flat command folder structure https://github.com/versenilvis/IRIS/pull/10/commits/87026a854a529ec5d5baed967d5f7a7f0085a24b - fix some linter problems https://github.com/versenilvis/IRIS/pull/10/commits/536de790cefda912f50bf4022e40ce2b965db2e2 - fix some gemini fix suggestions
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package text
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "find",
|
||||
Description: "search for files",
|
||||
Generator: core.FileGenerator("/"),
|
||||
Options: []core.Option{
|
||||
{Name: "-name", Description: "match by name"},
|
||||
{Name: "-iname", Description: "match by name (case insensitive)"},
|
||||
{Name: "-type", Description: "match by type (f=file, d=dir, l=link)"},
|
||||
{Name: "-size", Description: "match by size (+1M, -10k)"},
|
||||
{Name: "-mtime", Description: "modified n days ago"},
|
||||
{Name: "-atime", Description: "accessed n days ago"},
|
||||
{Name: "-ctime", Description: "changed n days ago"},
|
||||
{Name: "-newer", Description: "newer than file"},
|
||||
{Name: "-maxdepth", Description: "max depth to descend"},
|
||||
{Name: "-mindepth", Description: "min depth to start"},
|
||||
{Name: "-exec", Description: "execute command on match"},
|
||||
{Name: "-execdir", Description: "exec in matched dir"},
|
||||
{Name: "-delete", Description: "delete matched files"},
|
||||
{Name: "-print", Description: "print matched paths"},
|
||||
{Name: "-print0", Description: "null-terminated output"},
|
||||
{Name: "-empty", Description: "match empty files/dirs"},
|
||||
{Name: "-perm", Description: "match by permissions"},
|
||||
{Name: "-user", Description: "match by owner"},
|
||||
{Name: "-group", Description: "match by group"},
|
||||
{Name: "-not", Description: "negate expression"},
|
||||
{Name: "-or", Description: "logical OR"},
|
||||
{Name: "-and", Description: "logical AND"},
|
||||
{Name: "-prune", Description: "exclude from search"},
|
||||
{Name: "-ls", Description: "list in ls format"},
|
||||
{Name: "-xdev", Description: "don't cross filesystems"},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package text
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "grep",
|
||||
Description: "search text in files",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-r", Description: "recursive"},
|
||||
{Name: "-R", Description: "recursive + follow symlinks"},
|
||||
{Name: "-i", Description: "ignore case"},
|
||||
{Name: "-n", Description: "show line numbers"},
|
||||
{Name: "-v", Description: "invert match"},
|
||||
{Name: "-l", Description: "show filenames only"},
|
||||
{Name: "-L", Description: "files without match"},
|
||||
{Name: "-c", Description: "count matching lines"},
|
||||
{Name: "-E", Description: "extended regex (egrep)"},
|
||||
{Name: "-P", Description: "perl-compatible regex"},
|
||||
{Name: "-F", Description: "fixed string (fgrep)"},
|
||||
{Name: "-w", Description: "whole word match"},
|
||||
{Name: "-x", Description: "whole line match"},
|
||||
{Name: "-A", Description: "lines after match"},
|
||||
{Name: "-B", Description: "lines before match"},
|
||||
{Name: "-C", Description: "lines around match"},
|
||||
{Name: "-m", Description: "max matches per file"},
|
||||
{Name: "-o", Description: "only matching part"},
|
||||
{Name: "-q", Description: "quiet mode"},
|
||||
{Name: "--include", Description: "include file pattern"},
|
||||
{Name: "--exclude", Description: "exclude file pattern"},
|
||||
{Name: "--exclude-dir", Description: "exclude directory"},
|
||||
{Name: "-H", Description: "always print filename"},
|
||||
{Name: "-h", Description: "never print filename"},
|
||||
},
|
||||
})
|
||||
|
||||
// egrep and fgrep aliases
|
||||
core.Register(&core.Spec{
|
||||
Name: "egrep",
|
||||
Description: "grep with extended regex",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-r", Description: "recursive"},
|
||||
{Name: "-i", Description: "ignore case"},
|
||||
{Name: "-n", Description: "show line numbers"},
|
||||
{Name: "-v", Description: "invert match"},
|
||||
{Name: "-l", Description: "show filenames only"},
|
||||
{Name: "-w", Description: "whole word"},
|
||||
{Name: "-A", Description: "lines after"},
|
||||
{Name: "-B", Description: "lines before"},
|
||||
{Name: "-C", Description: "lines around"},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package text
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "rg",
|
||||
Description: "ripgrep (fast search)",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-i", Description: "case insensitive"},
|
||||
{Name: "-s", Description: "case sensitive"},
|
||||
{Name: "-n", Description: "show line numbers"},
|
||||
{Name: "-N", Description: "hide line numbers"},
|
||||
{Name: "-l", Description: "filenames only"},
|
||||
{Name: "-L", Description: "follow symlinks"},
|
||||
{Name: "-c", Description: "count matches"},
|
||||
{Name: "-w", Description: "word boundary match"},
|
||||
{Name: "-x", Description: "whole line match"},
|
||||
{Name: "-v", Description: "invert match"},
|
||||
{Name: "-o", Description: "only matching text"},
|
||||
{Name: "-A", Description: "lines after match"},
|
||||
{Name: "-B", Description: "lines before match"},
|
||||
{Name: "-C", Description: "lines around match"},
|
||||
{Name: "-m", Description: "max matches per file"},
|
||||
{Name: "-e", Description: "additional pattern"},
|
||||
{Name: "-f", Description: "patterns from file"},
|
||||
{Name: "--type", Description: "file type filter (e.g. go, py, js)"},
|
||||
{Name: "--type-not", Description: "exclude file type"},
|
||||
{Name: "--glob", Description: "include glob pattern"},
|
||||
{Name: "--iglob", Description: "include glob (case insensitive)"},
|
||||
{Name: "--hidden", Description: "search hidden files"},
|
||||
{Name: "--no-ignore", Description: "don't use .gitignore"},
|
||||
{Name: "--no-ignore-vcs", Description: "don't use VCS ignore"},
|
||||
{Name: "-g", Description: "include/exclude glob"},
|
||||
{Name: "--json", Description: "output as JSON"},
|
||||
{Name: "--stats", Description: "print match statistics"},
|
||||
{Name: "--color", Description: "colorize output (auto/always/never)"},
|
||||
{Name: "--no-heading", Description: "no file name headings"},
|
||||
{Name: "-H", Description: "always show filename"},
|
||||
{Name: "--max-depth", Description: "max directory depth"},
|
||||
{Name: "-p", Description: "smart heading/colors (for piping)"},
|
||||
{Name: "-U", Description: "multiline matching"},
|
||||
{Name: "--multiline", Description: "enable multiline"},
|
||||
{Name: "-F", Description: "treat pattern as literal string"},
|
||||
{Name: "--fixed-strings", Description: "literal string match"},
|
||||
{Name: "-z", Description: "search compressed files"},
|
||||
{Name: "--encoding", Description: "file encoding"},
|
||||
{Name: "--trim", Description: "trim whitespace"},
|
||||
},
|
||||
})
|
||||
|
||||
core.Register(&core.Spec{
|
||||
Name: "fd",
|
||||
Description: "fast find alternative",
|
||||
Generator: core.FileGenerator("/"),
|
||||
Options: []core.Option{
|
||||
{Name: "-t", Description: "type (f/d/l/x/e/s)"},
|
||||
{Name: "-e", Description: "file extension"},
|
||||
{Name: "-H", Description: "include hidden"},
|
||||
{Name: "-I", Description: "no gitignore"},
|
||||
{Name: "-d", Description: "max depth"},
|
||||
{Name: "-x", Description: "execute command"},
|
||||
{Name: "-X", Description: "exec batch"},
|
||||
{Name: "-l", Description: "long listing"},
|
||||
{Name: "-L", Description: "follow symlinks"},
|
||||
{Name: "-p", Description: "full path match"},
|
||||
{Name: "-g", Description: "glob pattern"},
|
||||
{Name: "-c", Description: "color mode"},
|
||||
{Name: "-0", Description: "null-separated output"},
|
||||
{Name: "-j", Description: "number of threads"},
|
||||
{Name: "--changed-within", Description: "recently changed"},
|
||||
{Name: "--changed-before", Description: "changed before date"},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package text
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// awk
|
||||
core.Register(&core.Spec{
|
||||
Name: "awk",
|
||||
Description: "pattern-directed scanning",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-F", Description: "field separator"},
|
||||
{Name: "-v", Description: "assign variable"},
|
||||
{Name: "-f", Description: "read program from file"},
|
||||
{Name: "-i", Description: "in-place edit (gawk)"},
|
||||
{Name: "--posix", Description: "POSIX compat mode"},
|
||||
{Name: "-W", Description: "compatibility options"},
|
||||
},
|
||||
})
|
||||
|
||||
// gawk is also common
|
||||
core.Register(&core.Spec{
|
||||
Name: "gawk",
|
||||
Description: "GNU awk",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-F", Description: "field separator"},
|
||||
{Name: "-v", Description: "assign variable"},
|
||||
{Name: "-f", Description: "read program from file"},
|
||||
{Name: "-i", Description: "in-place edit"},
|
||||
{Name: "--sandbox", Description: "sandbox mode"},
|
||||
{Name: "--profile", Description: "profiling output"},
|
||||
},
|
||||
})
|
||||
|
||||
// sed
|
||||
core.Register(&core.Spec{
|
||||
Name: "sed",
|
||||
Description: "stream editor",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-e", Description: "add expression"},
|
||||
{Name: "-f", Description: "read script from file"},
|
||||
{Name: "-i", Description: "in-place edit"},
|
||||
{Name: "-n", Description: "suppress default output"},
|
||||
{Name: "-E", Description: "extended regex"},
|
||||
{Name: "-r", Description: "extended regex (GNU)"},
|
||||
{Name: "-z", Description: "null-delimited lines"},
|
||||
{Name: "--sandbox", Description: "sandbox mode"},
|
||||
},
|
||||
})
|
||||
|
||||
// xargs
|
||||
core.Register(&core.Spec{
|
||||
Name: "xargs",
|
||||
Description: "build and run commands from stdin",
|
||||
Options: []core.Option{
|
||||
{Name: "-I", Description: "replace string (e.g. -I{})"},
|
||||
{Name: "-n", Description: "max args per command"},
|
||||
{Name: "-P", Description: "parallel jobs"},
|
||||
{Name: "-0", Description: "null-delimited input"},
|
||||
{Name: "-d", Description: "custom delimiter"},
|
||||
{Name: "-t", Description: "print command before executing"},
|
||||
{Name: "-p", Description: "prompt before executing"},
|
||||
{Name: "-r", Description: "no run if empty input"},
|
||||
{Name: "--no-run-if-empty", Description: "don't run if no input"},
|
||||
},
|
||||
})
|
||||
|
||||
// tr
|
||||
core.Register(&core.Spec{
|
||||
Name: "tr",
|
||||
Description: "translate or delete characters",
|
||||
Options: []core.Option{
|
||||
{Name: "-d", Description: "delete characters"},
|
||||
{Name: "-s", Description: "squeeze repeated chars"},
|
||||
{Name: "-c", Description: "complement set"},
|
||||
},
|
||||
})
|
||||
|
||||
// sort
|
||||
core.Register(&core.Spec{
|
||||
Name: "sort",
|
||||
Description: "sort lines of text",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-n", Description: "numeric sort"},
|
||||
{Name: "-r", Description: "reverse sort"},
|
||||
{Name: "-k", Description: "sort by key field"},
|
||||
{Name: "-t", Description: "field separator"},
|
||||
{Name: "-u", Description: "unique (remove duplicates)"},
|
||||
{Name: "-f", Description: "ignore case"},
|
||||
{Name: "-h", Description: "human-readable sort"},
|
||||
{Name: "-V", Description: "version sort"},
|
||||
{Name: "-o", Description: "output file"},
|
||||
{Name: "--parallel", Description: "parallel sort"},
|
||||
},
|
||||
})
|
||||
|
||||
// uniq
|
||||
core.Register(&core.Spec{
|
||||
Name: "uniq",
|
||||
Description: "filter adjacent duplicate lines",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-c", Description: "prefix count"},
|
||||
{Name: "-d", Description: "only duplicates"},
|
||||
{Name: "-u", Description: "only unique"},
|
||||
{Name: "-i", Description: "ignore case"},
|
||||
{Name: "-f", Description: "skip n fields"},
|
||||
{Name: "-s", Description: "skip n chars"},
|
||||
},
|
||||
})
|
||||
|
||||
// cut
|
||||
core.Register(&core.Spec{
|
||||
Name: "cut",
|
||||
Description: "extract columns from lines",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-d", Description: "delimiter"},
|
||||
{Name: "-f", Description: "field numbers (e.g. 1,3 or 1-3)"},
|
||||
{Name: "-c", Description: "character positions"},
|
||||
{Name: "--output-delimiter", Description: "output delimiter"},
|
||||
},
|
||||
})
|
||||
|
||||
// tee
|
||||
core.Register(&core.Spec{
|
||||
Name: "tee",
|
||||
Description: "read stdin, write to stdout and files",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-a", Description: "append to files"},
|
||||
{Name: "-i", Description: "ignore interrupts"},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user