From 2d6508b7818b36a7b7a76827374d20d620ef63cc Mon Sep 17 00:00:00 2001 From: David Tootill Date: Tue, 19 Apr 2016 17:22:31 -0700 Subject: [PATCH 1/2] Add output width control feature --- Godeps/Godeps.json | 13 ++ Godeps/Readme | 5 + Godeps/_workspace/.gitignore | 2 + .../DeMille/termsize/.gitattributes | 2 + .../src/github.com/DeMille/termsize/LICENSE | 20 +++ .../src/github.com/DeMille/termsize/README.md | 61 +++++++ .../github.com/DeMille/termsize/getsize.go | 42 +++++ .../DeMille/termsize/getsize_windows.go | 72 +++++++++ .../github.com/DeMille/termsize/termsize.go | 57 +++++++ README.md | 52 +++++- columnize.go | 149 ++++++++++++++++-- columnize_test.go | 96 ++++++++++- godep.sh | 3 + 13 files changed, 562 insertions(+), 12 deletions(-) create mode 100644 Godeps/Godeps.json create mode 100644 Godeps/Readme create mode 100644 Godeps/_workspace/.gitignore create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/README.md create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go create mode 100644 Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go create mode 100644 godep.sh diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json new file mode 100644 index 0000000..4e9d95b --- /dev/null +++ b/Godeps/Godeps.json @@ -0,0 +1,13 @@ +{ + "ImportPath": "github.com/CiscoCloud/columnize", + "GoVersion": "go1.4.2", + "Packages": [ + "." + ], + "Deps": [ + { + "ImportPath": "github.com/DeMille/termsize", + "Rev": "b7100f0f89ccfa4a591ca92363fe5d434f54666f" + } + ] +} diff --git a/Godeps/Readme b/Godeps/Readme new file mode 100644 index 0000000..4cdaa53 --- /dev/null +++ b/Godeps/Readme @@ -0,0 +1,5 @@ +This directory tree is generated automatically by godep. + +Please do not edit. + +See https://github.com/tools/godep for more information. diff --git a/Godeps/_workspace/.gitignore b/Godeps/_workspace/.gitignore new file mode 100644 index 0000000..f037d68 --- /dev/null +++ b/Godeps/_workspace/.gitignore @@ -0,0 +1,2 @@ +/pkg +/bin diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes b/Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes new file mode 100644 index 0000000..85ddc8a --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes @@ -0,0 +1,2 @@ +# +* text eol=lf \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE b/Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE new file mode 100644 index 0000000..9f82fd7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 Sterling DeMille + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/README.md b/Godeps/_workspace/src/github.com/DeMille/termsize/README.md new file mode 100644 index 0000000..70c9c43 --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/README.md @@ -0,0 +1,61 @@ +# Termsize + +Termsize is a cross platform go library to get terminal size. + +It is adapted from the syscalls implemented in [termbox-go](https://github.com/nsf/termbox-go), but doesn't require a full blown termbox setup. + +### Usage + +Install with `go get -u github.com/demille/termsize` + +```go +package main + +import ( + "fmt" + "github.com/demille/termsize" +) + +func main() { + if err := termsize.Init(); err != nil { + panic(err) + } + + w, h, err := termsize.Size() + if err != nil { + panic(err) + } + + fmt.Printf("Size: %d X %d \n", w, h) + // Size: 110 X 30 +} +``` + +Boom, terminal size. There isn't anything else to this package. + +### Reference + +[godoc.org/github.com/DeMille/termsize](https://godoc.org/github.com/DeMille/termsize) + +### License + +The MIT License (MIT) + +Copyright (c) 2015 Sterling DeMille <sterlingdemille@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go b/Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go new file mode 100644 index 0000000..d4d488a --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go @@ -0,0 +1,42 @@ +// +build !windows + +package termsize + +import ( + "os" + "syscall" + "unsafe" +) + +// +// adapted from termbox-go: +// github.com/nsf/termbox-go +// + +type winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +var f *os.File + +func initialize() (err error) { + f, err = os.OpenFile("/dev/tty", syscall.O_WRONLY, 0) + return err +} + +func get_size() (int, int, error) { + ws := &winsize{} + retCode, _, errno := syscall.Syscall(syscall.SYS_IOCTL, + f.Fd(), + uintptr(syscall.TIOCGWINSZ), + uintptr(unsafe.Pointer(ws))) + + if int(retCode) == -1 { + return 0, 0, errno + } + + return int(ws.Col), int(ws.Row), nil +} diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go b/Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go new file mode 100644 index 0000000..3dda72d --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go @@ -0,0 +1,72 @@ +package termsize + +import ( + "syscall" + "unsafe" +) + +// +// adapted from termbox-go: +// github.com/nsf/termbox-go +// + +type ( + short int16 + word uint16 + + coord struct { + x short + y short + } + + small_rect struct { + left short + top short + right short + bottom short + } + + buffer_info struct { + size coord + cursor_position coord + attributes word + window small_rect + maximum_window_size coord + } +) + +var ( + handle syscall.Handle + tmp_info buffer_info + kernel32 = syscall.NewLazyDLL("kernel32.dll") + proc = kernel32.NewProc("GetConsoleScreenBufferInfo") +) + +func initialize() (err error) { + handle, err = syscall.Open("CONOUT$", syscall.O_RDWR, 0) + return +} + +func get_size() (w, h int, err error) { + err = get_buffer_info(handle, &tmp_info) + if err != nil { + return + } + + w = int(tmp_info.window.right - tmp_info.window.left + 1) + h = int(tmp_info.window.bottom - tmp_info.window.top + 1) + return +} + +func get_buffer_info(h syscall.Handle, info *buffer_info) (err error) { + retCode, _, e1 := syscall.Syscall(proc.Addr(), + 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0) + if int(retCode) == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return +} diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go b/Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go new file mode 100644 index 0000000..ac7bc16 --- /dev/null +++ b/Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go @@ -0,0 +1,57 @@ +/* +Package termsize is a cross platform go library to get terminal size. + +It is adapted from the syscalls implemented in termbox-go, but doesn't require a full blown termbox setup. + + package main + + import ( + "fmt" + "github.com/demille/termsize" + ) + + func main() { + if err := termsize.Init(); err != nil { + panic(err) + } + + w, h, err := termsize.Size() + if err != nil { + panic(err) + } + + fmt.Printf("Size: %d X %d \n", w, h) + // Size: 110 X 30 + } +*/ +package termsize + +// +import ( + "errors" +) + +// Tracks initialization status +var IsInit bool + +// Initializes the termsize package. +// Needs to be called before requesting size. +func Init() (err error) { + err = initialize() + if err != nil { + return + } + + IsInit = true + return +} + +// Returns the terminal size +func Size() (w, h int, err error) { + if !IsInit { + err = errors.New("termsize not yet iniitialied") + return + } + + return get_size() +} diff --git a/README.md b/README.md index 6852911..e5f26eb 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ package main import ( "fmt" - "github.com/ryanuber/columnize" + "github.com/CiscoCloud/columnize" ) func main() { @@ -55,12 +55,18 @@ config.Delim = "|" config.Glue = " " config.Prefix = "" config.Empty = "" +config.MaxWidth = []int{10, 0, 0} +config.OutputWidth = 80 ``` * `Delim` is the string by which columns of **input** are delimited * `Glue` is the string by which columns of **output** are delimited * `Prefix` is a string by which each line of **output** is prefixed * `Empty` is a string used to replace blank values found in output +* `MaxWidth` is an int slice specifying the maximum width of each column. +* `OutputWidth` is an int specifying the maximum width of an output line. + +If MaxWidth or OutputWidth is specified and output exceeds the configured width, Columnize breaks a column at a word boundary and continues it on the next line. See below for details. You can then pass the `Config` in using the `Format` method (signature below) to have text formatted to your liking. @@ -73,3 +79,47 @@ SimpleFormat(intput []string) string Format(input []string, config *Config) string ``` + +Controlling Output Width +======================== +Output exceeding the width of the terminal window - particularly columnized output - can be difficult to read. To address this, Columnize provides two configuration parameters for controlling output width. + +* `MaxWidth` is an int slice specifying the maximum width of each column. If the data for a column exceeds its maximum width, Columnize formats the column into two or more lines by breaking its data at a word boundary and continuing it onto the next line. A zero or missing value for a MaxWidth element specifies that the corresponding column is uncontrolled (no maximum width). +* `OutputWidth` is an int value specifying the maximum width of the entire output line (including prefix and glue). If data width exceeds this value, Columnize sets a MaxWidth for the rightmost uncontrolled column so that the output width satisfies the restriction. You can specify `OutputWidth: columnize.AUTO` to use the actual width of the terminal window for OutputWidth. + +For example: + + input := []string{ + "Column a | Column b | Column c", + "xx | yy | zz", + "some quite long data | some more data | even longer data for the last column", + "this one will fit | a break | The quick brown fox jumps over the low lazy dog", + "qq | rr | ss", + } + config := Config{MaxWidth: []int{10, 0, 15}} + output := Format(input, &config) + +results in the output: + + Column a Column b Column c + xx yy zz + some quite some more data even longer + long data data for the + last column + this one a break The quick brown + will fit fox jumps over + the low lazy + dog + qq rr ss + +Specify OutputWidth to restrict the entire output line. For example, the configuration: + + config := Config{ + OutputWidth: columnize.AUTO, + } + +causes the entire output line to fit in the terminal window. Columnize modifies data lines exceeding the width of the window by setting the appropriate MaxWidth for the last column of data. Columnize adjusts the last uncontrolled column, so if you want it to adjust a column other than the last, specify an explicit MaxWidth for any columns to the right of the one you want Columnize to adjust. + + + + diff --git a/columnize.go b/columnize.go index d877859..ed605b5 100644 --- a/columnize.go +++ b/columnize.go @@ -3,6 +3,9 @@ package columnize import ( "fmt" "strings" + "unicode" + + "github.com/CiscoCloud/columnize/Godeps/_workspace/src/github.com/DeMille/termsize" ) type Config struct { @@ -17,14 +20,26 @@ type Config struct { // A replacement string to replace empty fields Empty string + + // Maximum width of output; set to AUTO to use actual console width + OutputWidth int + + // Maximum width of each column + MaxWidth []int } +const ( + AUTO = -1 +) + // Returns a Config with default values. func DefaultConfig() *Config { return &Config{ - Delim: "|", - Glue: " ", - Prefix: "", + Delim: "|", + Glue: " ", + Prefix: "", + OutputWidth: -999, + MaxWidth: []int{}, } } @@ -45,16 +60,70 @@ func getElementsFromLine(config *Config, line string) []interface{} { // Examines a list of strings and determines how wide each column should be // considering all of the elements that need to be printed within it. func getWidthsFromLines(config *Config, lines []string) []int { - var widths []int + widths := calculateColumnWidths(config, lines) + outputWidth := getOutputWidth(config) + widths = adjustWidths(config, widths, outputWidth) + return widths +} +// Calculate column widths by comparing data width and MaxWidth +func calculateColumnWidths(config *Config, lines []string) (widths []int) { for _, line := range lines { elems := getElementsFromLine(config, line) for i := 0; i < len(elems); i++ { - l := len(elems[i].(string)) + lenElem := len(elems[i].(string)) + if i < len(config.MaxWidth) { + if config.MaxWidth[i] < 0 { + fmt.Printf("Columnize: negative MaxWidth value not supported - please use OutputWidth\n") + } else if config.MaxWidth[i] > 0 && config.MaxWidth[i] < lenElem { + lenElem = config.MaxWidth[i] + } + } if len(widths) <= i { - widths = append(widths, l) - } else if widths[i] < l { - widths[i] = l + widths = append(widths, lenElem) + } else if widths[i] < lenElem { + widths[i] = lenElem + } + } + } + return +} + +// Get output width specification +func getOutputWidth(config *Config) (outputWidth int) { + outputWidth = config.OutputWidth + if outputWidth == AUTO { + var e error + if outputWidth, e = GetConsoleWidth(); e != nil { + fmt.Printf("Unable to set AUTO OutputWidth: %s\n", e.Error()) + } + } + return +} + +// If the output width is restricted and the output line will exceed that width, +// attempt to meet the restriction by adjusting the width of the rightmost +// unrestricted column, or the rightmost column if all columns are restricted. +func adjustWidths(config *Config, widths []int, outputWidth int) []int { + if outputWidth > 0 { + totalLineWidth := len(config.Prefix) + len(config.Glue)*(len(widths)-1) + for _, width := range widths { + totalLineWidth += width + } + if totalLineWidth > outputWidth { + adjIndex := -1 + for i := len(widths) - 1; i >= 0; i-- { + if i >= len(config.MaxWidth) || config.MaxWidth[i] <= 0 { + adjIndex = i + break + } + } + if adjIndex < 0 { + adjIndex = len(widths) - 1 + } + adjustedWidth := outputWidth - (totalLineWidth - widths[adjIndex]) + if adjustedWidth > 0 { + widths[adjIndex] = adjustedWidth } } } @@ -101,6 +170,12 @@ func MergeConfig(a, b *Config) *Config { if b.Empty != "" { result.Empty = b.Empty } + if b.OutputWidth >= 0 || b.OutputWidth == AUTO { + result.OutputWidth = b.OutputWidth + } + if len(b.MaxWidth) > 0 { + result.MaxWidth = b.MaxWidth + } return &result } @@ -116,8 +191,13 @@ func Format(lines []string, config *Config) string { // Create the formatted output using the format string for _, line := range lines { elems := getElementsFromLine(conf, line) - stringfmt := conf.getStringFormat(widths, len(elems)) - result += fmt.Sprintf(stringfmt, elems...) + extensionLineElems := []string{} + isStillDataToFormat := true + for isStillDataToFormat { + isStillDataToFormat = truncateToWidth(&elems, &extensionLineElems, widths) + stringfmt := conf.getStringFormat(widths, len(elems)) + result += fmt.Sprintf(stringfmt, elems...) + } } // Remove trailing newline without removing leading/trailing space @@ -132,3 +212,52 @@ func Format(lines []string, config *Config) string { func SimpleFormat(lines []string) string { return Format(lines, nil) } + +// Truncate any elements exceeding their maximum width, and save their remaining +// data for an extension line. +func truncateToWidth(elems *[]interface{}, extensionLineElems *[]string, widths []int) (isStillDataToFormat bool) { + + // If this an extension line, make its list of elements current + + if len(*extensionLineElems) > 0 { + for i, elem := range *extensionLineElems { + (*elems)[i] = elem + } + *extensionLineElems = []string{} + } + + // Examine each element to determine if it exceeds its maximum allowed width. + // If so, truncate it at the closest whitespace to the limit and save its remaining + // data for the next extension line. + + for i, elem := range *elems { + stringElem := strings.TrimSpace(fmt.Sprintf("%s", elem)) + if len(stringElem) > widths[i] { + isStillDataToFormat = true + splitPoint := widths[i] + for ; splitPoint > 0; splitPoint-- { + if unicode.IsSpace(rune(stringElem[splitPoint])) { + break + } + } + if splitPoint == 0 { + splitPoint = widths[i] + } + (*elems)[i] = strings.TrimSpace(stringElem[:splitPoint]) + if len(*extensionLineElems) == 0 { + (*extensionLineElems) = make([]string, len(*elems)) + } + (*extensionLineElems)[i] = strings.TrimSpace(stringElem[splitPoint:]) + } + + } + return +} + +// Get the width of the console +func GetConsoleWidth() (width int, e error) { + if e = termsize.Init(); e == nil { + width, _, e = termsize.Size() + } + return +} diff --git a/columnize_test.go b/columnize_test.go index 7bec390..55bb06b 100644 --- a/columnize_test.go +++ b/columnize_test.go @@ -1,6 +1,11 @@ package columnize -import "testing" +import ( + "fmt" + "math" + "strings" + "testing" +) func TestListOfStringsInput(t *testing.T) { input := []string{ @@ -240,3 +245,92 @@ func TestMergeConfig(t *testing.T) { t.Fatalf("bad: %#v", m) } } + +func TestMaxWidth(t *testing.T) { + input := []string{ + "Column a | Column b | Column c", + "xx | yy | zz", + "some quite long data | some more data | even longer data for the last column", + "this one will fit | a break | The quick brown fox jumps over the low lazy dog", + "qq | rr | ss", + } + config := Config{MaxWidth: []int{10, 0, 15}} + output := Format(input, &config) + expected := "Column a Column b Column c\n" + expected += "xx yy zz\n" + expected += "some quite some more data even longer\n" + expected += "long data data for the\n" + expected += " last column\n" + expected += "this one a break The quick brown\n" + expected += "will fit fox jumps over\n" + expected += " the low lazy\n" + expected += " dog\n" + expected += "qq rr ss" + + if output != expected { + for i, c := range output { + expectedChar := " " + if i < len(expected) { + expectedChar = string(expected[i]) + } + if c != rune(expectedChar[0]) { + nearStart := int(math.Max(0, float64(i-4))) + nearEnd := int(math.Min(float64(i+4), float64(len(output)))) + near := strings.Replace(output[nearStart:nearEnd], "\n", " ", -1) + fmt.Printf("TestMaxWidth difference at column %d near \"%s\": got(%s) expected(%s)\n", i, near, string(c), string(expectedChar)) + } + } + t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output) + } +} + +func TestOutputWidth(t *testing.T) { + input := []string{ + "Column a | Column b | Column c", + "xx | yy | zz", + "some quite long data | some more data | even longer data for the last column", + "this one will fit | a break | The quick brown fox jumps over the low lazy dog", + "qq | rr | ss", + } + config := Config{OutputWidth: 60} + output := Format(input, &config) + expected := "Column a Column b Column c\n" + expected += "xx yy zz\n" + expected += "some quite long data some more data even longer data for\n" + expected += " the last column\n" + expected += "this one will fit a break The quick brown fox\n" + expected += " jumps over the low\n" + expected += " lazy dog\n" + expected += "qq rr ss" + + if output != expected { + for i, c := range output { + expectedChar := " " + if i < len(expected) { + expectedChar = string(expected[i]) + } + if c != rune(expectedChar[0]) { + nearStart := int(math.Max(0, float64(i-4))) + nearEnd := int(math.Min(float64(i+4), float64(len(output)))) + near := strings.Replace(output[nearStart:nearEnd], "\n", " ", -1) + fmt.Printf("TestOutputWidth difference at column %d near \"%s\": got(%s) expected(%s)\n", i, near, string(c), string(expectedChar)) + } + } + t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output) + } +} + +func TestGetConsoleWidth(t *testing.T) { + if width, e := GetConsoleWidth(); e != nil { + t.Fatalf("Error getting console width: %s", e.Error()) + } else { + fmt.Printf("Console width is %d\n", width) + } + config := Config{OutputWidth: AUTO} + input := []string{ + "Column A | Column B | Column C", + "This is column A data | This is column B data | This is column C data that should wrap if the terminal width is too small for it", + } + output := Format(input, &config) + fmt.Printf("%s\n", output) +} diff --git a/godep.sh b/godep.sh new file mode 100644 index 0000000..10a65b4 --- /dev/null +++ b/godep.sh @@ -0,0 +1,3 @@ +#!/bin/sh -x +rm -f Godeps/Godeps.json +godep save -r -t . From 2c6eb9a3f5de6d215edaa42fd40ce2239cd4dcdb Mon Sep 17 00:00:00 2001 From: David Tootill Date: Mon, 2 May 2016 18:10:37 -0700 Subject: [PATCH 2/2] Switch to Go vendoring --- Godeps/Godeps.json | 3 ++- Godeps/_workspace/.gitignore | 2 -- columnize.go | 2 +- godep.sh | 2 +- .../src => vendor}/github.com/DeMille/termsize/.gitattributes | 0 .../src => vendor}/github.com/DeMille/termsize/LICENSE | 0 .../src => vendor}/github.com/DeMille/termsize/README.md | 0 .../src => vendor}/github.com/DeMille/termsize/getsize.go | 0 .../github.com/DeMille/termsize/getsize_windows.go | 0 .../src => vendor}/github.com/DeMille/termsize/termsize.go | 0 10 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 Godeps/_workspace/.gitignore rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/.gitattributes (100%) rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/LICENSE (100%) rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/README.md (100%) rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/getsize.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/getsize_windows.go (100%) rename {Godeps/_workspace/src => vendor}/github.com/DeMille/termsize/termsize.go (100%) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 4e9d95b..07fc101 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,7 @@ { "ImportPath": "github.com/CiscoCloud/columnize", - "GoVersion": "go1.4.2", + "GoVersion": "go1.6", + "GodepVersion": "v62", "Packages": [ "." ], diff --git a/Godeps/_workspace/.gitignore b/Godeps/_workspace/.gitignore deleted file mode 100644 index f037d68..0000000 --- a/Godeps/_workspace/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/pkg -/bin diff --git a/columnize.go b/columnize.go index ed605b5..aca756e 100644 --- a/columnize.go +++ b/columnize.go @@ -5,7 +5,7 @@ import ( "strings" "unicode" - "github.com/CiscoCloud/columnize/Godeps/_workspace/src/github.com/DeMille/termsize" + "github.com/DeMille/termsize" ) type Config struct { diff --git a/godep.sh b/godep.sh index 10a65b4..1f5e31e 100644 --- a/godep.sh +++ b/godep.sh @@ -1,3 +1,3 @@ #!/bin/sh -x rm -f Godeps/Godeps.json -godep save -r -t . +godep save -t . diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes b/vendor/github.com/DeMille/termsize/.gitattributes similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/.gitattributes rename to vendor/github.com/DeMille/termsize/.gitattributes diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE b/vendor/github.com/DeMille/termsize/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/LICENSE rename to vendor/github.com/DeMille/termsize/LICENSE diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/README.md b/vendor/github.com/DeMille/termsize/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/README.md rename to vendor/github.com/DeMille/termsize/README.md diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go b/vendor/github.com/DeMille/termsize/getsize.go similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/getsize.go rename to vendor/github.com/DeMille/termsize/getsize.go diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go b/vendor/github.com/DeMille/termsize/getsize_windows.go similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/getsize_windows.go rename to vendor/github.com/DeMille/termsize/getsize_windows.go diff --git a/Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go b/vendor/github.com/DeMille/termsize/termsize.go similarity index 100% rename from Godeps/_workspace/src/github.com/DeMille/termsize/termsize.go rename to vendor/github.com/DeMille/termsize/termsize.go