feat(commands): refactor and add more commands
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "cat",
|
||||
Description: "concatenate and print",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-n", Description: "number lines"},
|
||||
{Name: "-b", Description: "number non-blank"},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "head",
|
||||
Description: "output first lines of file",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-n", Description: "number of lines"},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "less",
|
||||
Description: "view file contents (scrollable)",
|
||||
Generator: core.FileGenerator(),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/versenilvis/iris/commands/core"
|
||||
)
|
||||
|
||||
func init() {
|
||||
core.Register(&core.Spec{
|
||||
Name: "tail",
|
||||
Description: "output last lines of file",
|
||||
Generator: core.FileGenerator(),
|
||||
Options: []core.Option{
|
||||
{Name: "-n", Description: "number of lines"},
|
||||
{Name: "-f", Description: "follow (live updates)"},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user