Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8438089e
Commit
8438089e
authored
Oct 07, 2016
by
Fabiano Franz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add heredoc and go-wordwrap dependencies
parent
714f816a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
362 additions
and
0 deletions
+362
-0
Godeps.json
Godeps/Godeps.json
+8
-0
LICENSES
Godeps/LICENSES
+58
-0
LICENSE
vendor/github.com/MakeNowJust/heredoc/LICENSE
+21
-0
README.md
vendor/github.com/MakeNowJust/heredoc/README.md
+53
-0
heredoc.go
vendor/github.com/MakeNowJust/heredoc/heredoc.go
+89
-0
LICENSE.md
vendor/github.com/mitchellh/go-wordwrap/LICENSE.md
+21
-0
README.md
vendor/github.com/mitchellh/go-wordwrap/README.md
+39
-0
wordwrap.go
vendor/github.com/mitchellh/go-wordwrap/wordwrap.go
+73
-0
No files found.
Godeps/Godeps.json
View file @
8438089e
...
...
@@ -66,6 +66,10 @@
"Rev"
:
"2492d97b402e00797833c03ac5fa1c572c7bb29a"
},
{
"ImportPath"
:
"github.com/MakeNowJust/heredoc"
,
"Rev"
:
"1d91351acdc1cb2f2c995864674b754134b86ca7"
},
{
"ImportPath"
:
"github.com/Microsoft/go-winio"
,
"Comment"
:
"v0.1.0"
,
"Rev"
:
"8f9387ea7efabb228a981b9c381142be7667967f"
...
...
@@ -1538,6 +1542,10 @@
"Rev"
:
"1b4ae6fb4e77b095934d4430860ff202060169f8"
},
{
"ImportPath"
:
"github.com/mitchellh/go-wordwrap"
,
"Rev"
:
"ad45545899c7b13c020ea92b2072220eefad42b8"
},
{
"ImportPath"
:
"github.com/mitchellh/mapstructure"
,
"Rev"
:
"740c764bc6149d3f1806231418adb9f52c11bcbf"
},
...
...
Godeps/LICENSES
View file @
8438089e
...
...
@@ -51180,6 +51180,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
================================================================================
= vendor/github.com/MakeNowJust/heredoc licensed under: =
The MIT License (MIT)
Copyright (c) 2014 TSUYUSATO Kitsune
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.
= vendor/github.com/MakeNowJust/heredoc/LICENSE 15e1c8f1d3c204c05f71630afacbc92b -
================================================================================
================================================================================
= vendor/github.com/matttproud/golang_protobuf_extensions/pbutil licensed under: =
Apache License
...
...
@@ -52707,6 +52736,35 @@ Apache License
================================================================================
=
vendor
/
github
.
com
/
mitchellh
/
go
-
wordwrap
licensed
under
:
=
The
MIT
License
(
MIT
)
Copyright
(
c
)
2014
Mitchell
Hashimoto
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
.
=
vendor
/
github
.
com
/
mitchellh
/
go
-
wordwrap
/
LICENSE
.
md
56
da355a12d4821cda57b8f23ec34bc4
-
================================================================================
================================================================================
=
vendor
/
github
.
com
/
mitchellh
/
mapstructure
licensed
under
:
=
The
MIT
License
(
MIT
)
vendor/github.com/MakeNowJust/heredoc/LICENSE
0 → 100644
View file @
8438089e
The MIT License (MIT)
Copyright (c) 2014 TSUYUSATO Kitsune
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.
vendor/github.com/MakeNowJust/heredoc/README.md
0 → 100644
View file @
8438089e
#heredoc [](https://drone.io/github.com/MakeNowJust/heredoc/latest) [](https://gowalker.org/github.com/MakeNowJust/heredoc)
##About
Package heredoc provides the here-document with keeping indent.
##Install
```
console
$
go get github.com/MakeNowJust/heredoc
```
##Import
```
go
// usual
import
"github.com/MakeNowJust/heredoc"
// shortcuts
import
.
"github.com/MakeNowJust/heredoc/dot"
```
##Example
```
go
package
main
import
(
"fmt"
.
"github.com/MakeNowJust/heredoc/dot"
)
func
main
()
{
fmt
.
Println
(
D
(
`
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, ...
`
))
// Output:
// Lorem ipsum dolor sit amet, consectetur adipisicing elit,
// sed do eiusmod tempor incididunt ut labore et dolore magna
// aliqua. Ut enim ad minim veniam, ...
//
}
```
##API Document
-
[
Go Walker - github.com/MakeNowJust/heredoc
](
https://gowalker.org/github.com/MakeNowJust/heredoc
)
-
[
Go Walker - github.com/MakeNowJust/heredoc/dot
](
https://gowalker.org/github.com/MakeNowJust/heredoc/dot
)
##License
This software is released under the MIT License, see LICENSE.
vendor/github.com/MakeNowJust/heredoc/heredoc.go
0 → 100644
View file @
8438089e
// Copyright (c) 2014 TSUYUSATO Kitsune
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// Package heredoc provides the here-document with keeping indent.
//
// Golang supports raw-string syntax.
// doc := `
// Foo
// Bar
// `
// But raw-string cannot recognize indent. Thus such content is indented string, equivalent to
// "\n\tFoo\n\tBar\n"
// I dont't want this!
//
// However this problem is solved by package heredoc.
// doc := heredoc.Doc(`
// Foo
// Bar
// `)
// It is equivalent to
// "Foo\nBar\n"
package
heredoc
import
(
"fmt"
"strings"
"unicode"
)
// heredoc.Doc retutns unindented string as here-document.
//
// Process of making here-document:
// 1. Find most little indent size. (Skip empty lines)
// 2. Remove this indents of lines.
func
Doc
(
raw
string
)
string
{
skipFirstLine
:=
false
if
raw
[
0
]
==
'\n'
{
raw
=
raw
[
1
:
]
}
else
{
skipFirstLine
=
true
}
minIndentSize
:=
int
(
^
uint
(
0
)
>>
1
)
// Max value of type int
lines
:=
strings
.
Split
(
raw
,
"
\n
"
)
// 1.
for
i
,
line
:=
range
lines
{
if
i
==
0
&&
skipFirstLine
{
continue
}
indentSize
:=
0
for
_
,
r
:=
range
[]
rune
(
line
)
{
if
unicode
.
IsSpace
(
r
)
{
indentSize
+=
1
}
else
{
break
}
}
if
len
(
line
)
==
indentSize
{
if
i
==
len
(
lines
)
-
1
&&
indentSize
<
minIndentSize
{
lines
[
i
]
=
""
}
}
else
if
indentSize
<
minIndentSize
{
minIndentSize
=
indentSize
}
}
// 2.
for
i
,
line
:=
range
lines
{
if
i
==
0
&&
skipFirstLine
{
continue
}
if
len
(
lines
[
i
])
>=
minIndentSize
{
lines
[
i
]
=
line
[
minIndentSize
:
]
}
}
return
strings
.
Join
(
lines
,
"
\n
"
)
}
// heredoc.Docf returns unindented and formatted string as here-document.
// This format is same with package fmt's format.
func
Docf
(
raw
string
,
args
...
interface
{})
string
{
return
fmt
.
Sprintf
(
Doc
(
raw
),
args
...
)
}
vendor/github.com/mitchellh/go-wordwrap/LICENSE.md
0 → 100644
View file @
8438089e
The MIT License (MIT)
Copyright (c) 2014 Mitchell Hashimoto
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.
vendor/github.com/mitchellh/go-wordwrap/README.md
0 → 100644
View file @
8438089e
# go-wordwrap
`go-wordwrap`
(Golang package:
`wordwrap`
) is a package for Go that
automatically wraps words into multiple lines. The primary use case for this
is in formatting CLI output, but of course word wrapping is a generally useful
thing to do.
## Installation and Usage
Install using
`go get github.com/mitchellh/go-wordwrap`
.
Full documentation is available at
http://godoc.org/github.com/mitchellh/go-wordwrap
Below is an example of its usage ignoring errors:
```
go
wrapped
:=
wordwrap
.
WrapString
(
"foo bar baz"
,
3
)
fmt
.
Println
(
wrapped
)
```
Would output:
```
foo
bar
baz
```
## Word Wrap Algorithm
This library doesn't use any clever algorithm for word wrapping. The wrapping
is actually very naive: whenever there is whitespace or an explicit linebreak.
The goal of this library is for word wrapping CLI output, so the input is
typically pretty well controlled human language. Because of this, the naive
approach typically works just fine.
In the future, we'd like to make the algorithm more advanced. We would do
so without breaking the API.
vendor/github.com/mitchellh/go-wordwrap/wordwrap.go
0 → 100644
View file @
8438089e
package
wordwrap
import
(
"bytes"
"unicode"
)
// WrapString wraps the given string within lim width in characters.
//
// Wrapping is currently naive and only happens at white-space. A future
// version of the library will implement smarter wrapping. This means that
// pathological cases can dramatically reach past the limit, such as a very
// long word.
func
WrapString
(
s
string
,
lim
uint
)
string
{
// Initialize a buffer with a slightly larger size to account for breaks
init
:=
make
([]
byte
,
0
,
len
(
s
))
buf
:=
bytes
.
NewBuffer
(
init
)
var
current
uint
var
wordBuf
,
spaceBuf
bytes
.
Buffer
for
_
,
char
:=
range
s
{
if
char
==
'\n'
{
if
wordBuf
.
Len
()
==
0
{
if
current
+
uint
(
spaceBuf
.
Len
())
>
lim
{
current
=
0
}
else
{
current
+=
uint
(
spaceBuf
.
Len
())
spaceBuf
.
WriteTo
(
buf
)
}
spaceBuf
.
Reset
()
}
else
{
current
+=
uint
(
spaceBuf
.
Len
()
+
wordBuf
.
Len
())
spaceBuf
.
WriteTo
(
buf
)
spaceBuf
.
Reset
()
wordBuf
.
WriteTo
(
buf
)
wordBuf
.
Reset
()
}
buf
.
WriteRune
(
char
)
current
=
0
}
else
if
unicode
.
IsSpace
(
char
)
{
if
spaceBuf
.
Len
()
==
0
||
wordBuf
.
Len
()
>
0
{
current
+=
uint
(
spaceBuf
.
Len
()
+
wordBuf
.
Len
())
spaceBuf
.
WriteTo
(
buf
)
spaceBuf
.
Reset
()
wordBuf
.
WriteTo
(
buf
)
wordBuf
.
Reset
()
}
spaceBuf
.
WriteRune
(
char
)
}
else
{
wordBuf
.
WriteRune
(
char
)
if
current
+
uint
(
spaceBuf
.
Len
()
+
wordBuf
.
Len
())
>
lim
&&
uint
(
wordBuf
.
Len
())
<
lim
{
buf
.
WriteRune
(
'\n'
)
current
=
0
spaceBuf
.
Reset
()
}
}
}
if
wordBuf
.
Len
()
==
0
{
if
current
+
uint
(
spaceBuf
.
Len
())
<=
lim
{
spaceBuf
.
WriteTo
(
buf
)
}
}
else
{
spaceBuf
.
WriteTo
(
buf
)
wordBuf
.
WriteTo
(
buf
)
}
return
buf
.
String
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment