mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
get rid of global variables, makes testing way easier
This commit is contained in:
@@ -17,74 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package lib
|
||||
|
||||
import (
|
||||
"github.com/gookit/color"
|
||||
)
|
||||
|
||||
var (
|
||||
// command line flags
|
||||
Debug bool
|
||||
XtendedOut bool
|
||||
NoNumbering bool
|
||||
ShowVersion bool
|
||||
Columns string
|
||||
UseColumns []int
|
||||
DefaultSeparator string = `(\s\s+|\t)`
|
||||
Separator string = `(\s\s+|\t)`
|
||||
OutflagExtended bool
|
||||
OutflagMarkdown bool
|
||||
OutflagOrgtable bool
|
||||
OutflagShell bool
|
||||
OutflagYaml bool
|
||||
OutputMode string
|
||||
InvertMatch bool
|
||||
Pattern string
|
||||
|
||||
/*
|
||||
FIXME: make configurable somehow, config file or ENV
|
||||
see https://github.com/gookit/color will be set by
|
||||
io.ProcessFiles() according to currently supported
|
||||
color mode.
|
||||
*/
|
||||
MatchFG string
|
||||
MatchBG string
|
||||
NoColor bool
|
||||
|
||||
// colors to be used per supported color mode
|
||||
Colors = map[color.Level]map[string]string{
|
||||
color.Level16: {
|
||||
"bg": "green", "fg": "black",
|
||||
},
|
||||
color.Level256: {
|
||||
"bg": "lightGreen", "fg": "black",
|
||||
},
|
||||
color.LevelRgb: {
|
||||
// FIXME: maybe use something nicer
|
||||
"bg": "lightGreen", "fg": "black",
|
||||
},
|
||||
}
|
||||
|
||||
// used for validation
|
||||
validOutputmodes = "(orgtbl|markdown|extended|ascii|yaml)"
|
||||
|
||||
// main program version
|
||||
Version = "v1.0.11"
|
||||
|
||||
// generated version string, used by -v contains lib.Version on
|
||||
// main branch, and lib.Version-$branch-$lastcommit-$date on
|
||||
// development branch
|
||||
VERSION string
|
||||
|
||||
// sorting
|
||||
SortByColumn int
|
||||
SortDescending bool
|
||||
|
||||
SortNumeric bool
|
||||
SortTime bool
|
||||
SortAge bool
|
||||
SortMode string
|
||||
)
|
||||
|
||||
// contains a whole parsed table
|
||||
type Tabdata struct {
|
||||
maxwidthHeader int // longest header
|
||||
|
||||
Reference in New Issue
Block a user