mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
CmdRunner now displays ANSI color codes
This commit is contained in:
2
vendor/github.com/google/go-github/github/apps.go
generated
vendored
2
vendor/github.com/google/go-github/github/apps.go
generated
vendored
@@ -57,6 +57,8 @@ type Installation struct {
|
||||
RepositorySelection *string `json:"repository_selection,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
Permissions *InstallationPermissions `json:"permissions,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
func (i Installation) String() string {
|
||||
|
||||
16
vendor/github.com/google/go-github/github/github-accessors.go
generated
vendored
16
vendor/github.com/google/go-github/github/github-accessors.go
generated
vendored
@@ -2828,6 +2828,14 @@ func (i *Installation) GetAppID() int64 {
|
||||
return *i.AppID
|
||||
}
|
||||
|
||||
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
|
||||
func (i *Installation) GetCreatedAt() time.Time {
|
||||
if i == nil || i.CreatedAt == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
return *i.CreatedAt
|
||||
}
|
||||
|
||||
// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
|
||||
func (i *Installation) GetHTMLURL() string {
|
||||
if i == nil || i.HTMLURL == nil {
|
||||
@@ -2892,6 +2900,14 @@ func (i *Installation) GetTargetType() string {
|
||||
return *i.TargetType
|
||||
}
|
||||
|
||||
// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
|
||||
func (i *Installation) GetUpdatedAt() time.Time {
|
||||
if i == nil || i.UpdatedAt == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
return *i.UpdatedAt
|
||||
}
|
||||
|
||||
// GetAction returns the Action field if it's non-nil, zero value otherwise.
|
||||
func (i *InstallationEvent) GetAction() string {
|
||||
if i == nil || i.Action == nil {
|
||||
|
||||
3
vendor/github.com/google/go-github/github/github.go
generated
vendored
3
vendor/github.com/google/go-github/github/github.go
generated
vendored
@@ -45,9 +45,6 @@ const (
|
||||
|
||||
// Media Type values to access preview APIs
|
||||
|
||||
// https://developer.github.com/changes/2015-03-09-licenses-api/
|
||||
mediaTypeLicensesPreview = "application/vnd.github.drax-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
|
||||
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
|
||||
|
||||
|
||||
6
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
6
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
@@ -67,9 +67,6 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
var licenses []*License
|
||||
resp, err := s.client.Do(ctx, req, &licenses)
|
||||
if err != nil {
|
||||
@@ -90,9 +87,6 @@ func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
license := new(License)
|
||||
resp, err := s.client.Do(ctx, req, license)
|
||||
if err != nil {
|
||||
|
||||
28
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
28
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
@@ -14,7 +14,7 @@ import (
|
||||
// PullRequestComment represents a comment left on a pull request.
|
||||
type PullRequestComment struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
InReplyTo *int64 `json:"in_reply_to,omitempty"`
|
||||
InReplyTo *int64 `json:"in_reply_to_id,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
DiffHunk *string `json:"diff_hunk,omitempty"`
|
||||
@@ -129,6 +129,32 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, r
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#alternative-input
|
||||
func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) {
|
||||
comment := &struct {
|
||||
Body string `json:"body,omitempty"`
|
||||
InReplyTo int64 `json:"in_reply_to,omitempty"`
|
||||
}{
|
||||
Body: body,
|
||||
InReplyTo: commentID,
|
||||
}
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
|
||||
req, err := s.client.NewRequest("POST", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
c := new(PullRequestComment)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// EditComment updates a pull request comment.
|
||||
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
||||
//
|
||||
|
||||
12
vendor/github.com/google/go-github/github/repos.go
generated
vendored
12
vendor/github.com/google/go-github/github/repos.go
generated
vendored
@@ -178,7 +178,7 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opt *Reposi
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
@@ -216,7 +216,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *Re
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
@@ -297,7 +297,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
|
||||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
repository := new(Repository)
|
||||
@@ -341,10 +341,6 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
repository := new(Repository)
|
||||
resp, err := s.client.Do(ctx, req, repository)
|
||||
if err != nil {
|
||||
@@ -1018,7 +1014,7 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo
|
||||
// TransferRequest represents a request to transfer a repository.
|
||||
type TransferRequest struct {
|
||||
NewOwner string `json:"new_owner"`
|
||||
TeamID []int64 `json:"team_id,omitempty"`
|
||||
TeamID []int64 `json:"team_ids,omitempty"`
|
||||
}
|
||||
|
||||
// Transfer transfers a repository from one account or organization to another.
|
||||
|
||||
16
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
16
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
@@ -136,9 +136,13 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
hook := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, hook)
|
||||
return hook, resp, err
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// EditHook updates a specified Hook.
|
||||
@@ -152,7 +156,11 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string,
|
||||
}
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
return h, resp, err
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// DeleteHook deletes a specified Hook.
|
||||
|
||||
11
vendor/github.com/pkg/profile/.travis.yml
generated
vendored
Normal file
11
vendor/github.com/pkg/profile/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
language: go
|
||||
go_import_path: github.com/pkg/profile
|
||||
go:
|
||||
- 1.4.3
|
||||
- 1.5.2
|
||||
- 1.6.3
|
||||
- tip
|
||||
|
||||
script:
|
||||
- go test github.com/pkg/profile
|
||||
- go test -race github.com/pkg/profile
|
||||
1
vendor/github.com/pkg/profile/AUTHORS
generated
vendored
Normal file
1
vendor/github.com/pkg/profile/AUTHORS
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Dave Cheney <dave@cheney.net>
|
||||
24
vendor/github.com/pkg/profile/LICENSE
generated
vendored
Normal file
24
vendor/github.com/pkg/profile/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2013 Dave Cheney. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
54
vendor/github.com/pkg/profile/README.md
generated
vendored
Normal file
54
vendor/github.com/pkg/profile/README.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
profile
|
||||
=======
|
||||
|
||||
Simple profiling support package for Go
|
||||
|
||||
[](https://travis-ci.org/pkg/profile) [](http://godoc.org/github.com/pkg/profile)
|
||||
|
||||
|
||||
installation
|
||||
------------
|
||||
|
||||
go get github.com/pkg/profile
|
||||
|
||||
usage
|
||||
-----
|
||||
|
||||
Enabling profiling in your application is as simple as one line at the top of your main function
|
||||
|
||||
```go
|
||||
import "github.com/pkg/profile"
|
||||
|
||||
func main() {
|
||||
defer profile.Start().Stop()
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
options
|
||||
-------
|
||||
|
||||
What to profile is controlled by config value passed to profile.Start.
|
||||
By default CPU profiling is enabled.
|
||||
|
||||
```go
|
||||
import "github.com/pkg/profile"
|
||||
|
||||
func main() {
|
||||
// p.Stop() must be called before the program exits to
|
||||
// ensure profiling information is written to disk.
|
||||
p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Several convenience package level values are provided for cpu, memory, and block (contention) profiling.
|
||||
|
||||
For more complex options, consult the [documentation](http://godoc.org/github.com/pkg/profile).
|
||||
|
||||
contributing
|
||||
------------
|
||||
|
||||
We welcome pull requests, bug fixes and issue reports.
|
||||
|
||||
Before proposing a change, please discuss it first by raising an issue.
|
||||
13
vendor/github.com/pkg/profile/mutex.go
generated
vendored
Normal file
13
vendor/github.com/pkg/profile/mutex.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// +build go1.8
|
||||
|
||||
package profile
|
||||
|
||||
import "runtime"
|
||||
|
||||
func enableMutexProfile() {
|
||||
runtime.SetMutexProfileFraction(1)
|
||||
}
|
||||
|
||||
func disableMutexProfile() {
|
||||
runtime.SetMutexProfileFraction(0)
|
||||
}
|
||||
9
vendor/github.com/pkg/profile/mutex17.go
generated
vendored
Normal file
9
vendor/github.com/pkg/profile/mutex17.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// +build !go1.8
|
||||
|
||||
package profile
|
||||
|
||||
// mock mutex support for Go 1.7 and earlier.
|
||||
|
||||
func enableMutexProfile() {}
|
||||
|
||||
func disableMutexProfile() {}
|
||||
244
vendor/github.com/pkg/profile/profile.go
generated
vendored
Normal file
244
vendor/github.com/pkg/profile/profile.go
generated
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
// Package profile provides a simple way to manage runtime/pprof
|
||||
// profiling of your Go application.
|
||||
package profile
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const (
|
||||
cpuMode = iota
|
||||
memMode
|
||||
mutexMode
|
||||
blockMode
|
||||
traceMode
|
||||
)
|
||||
|
||||
// Profile represents an active profiling session.
|
||||
type Profile struct {
|
||||
// quiet suppresses informational messages during profiling.
|
||||
quiet bool
|
||||
|
||||
// noShutdownHook controls whether the profiling package should
|
||||
// hook SIGINT to write profiles cleanly.
|
||||
noShutdownHook bool
|
||||
|
||||
// mode holds the type of profiling that will be made
|
||||
mode int
|
||||
|
||||
// path holds the base path where various profiling files are written.
|
||||
// If blank, the base path will be generated by ioutil.TempDir.
|
||||
path string
|
||||
|
||||
// memProfileRate holds the rate for the memory profile.
|
||||
memProfileRate int
|
||||
|
||||
// closer holds a cleanup function that run after each profile
|
||||
closer func()
|
||||
|
||||
// stopped records if a call to profile.Stop has been made
|
||||
stopped uint32
|
||||
}
|
||||
|
||||
// NoShutdownHook controls whether the profiling package should
|
||||
// hook SIGINT to write profiles cleanly.
|
||||
// Programs with more sophisticated signal handling should set
|
||||
// this to true and ensure the Stop() function returned from Start()
|
||||
// is called during shutdown.
|
||||
func NoShutdownHook(p *Profile) { p.noShutdownHook = true }
|
||||
|
||||
// Quiet suppresses informational messages during profiling.
|
||||
func Quiet(p *Profile) { p.quiet = true }
|
||||
|
||||
// CPUProfile enables cpu profiling.
|
||||
// It disables any previous profiling settings.
|
||||
func CPUProfile(p *Profile) { p.mode = cpuMode }
|
||||
|
||||
// DefaultMemProfileRate is the default memory profiling rate.
|
||||
// See also http://golang.org/pkg/runtime/#pkg-variables
|
||||
const DefaultMemProfileRate = 4096
|
||||
|
||||
// MemProfile enables memory profiling.
|
||||
// It disables any previous profiling settings.
|
||||
func MemProfile(p *Profile) {
|
||||
p.memProfileRate = DefaultMemProfileRate
|
||||
p.mode = memMode
|
||||
}
|
||||
|
||||
// MemProfileRate enables memory profiling at the preferred rate.
|
||||
// It disables any previous profiling settings.
|
||||
func MemProfileRate(rate int) func(*Profile) {
|
||||
return func(p *Profile) {
|
||||
p.memProfileRate = rate
|
||||
p.mode = memMode
|
||||
}
|
||||
}
|
||||
|
||||
// MutexProfile enables mutex profiling.
|
||||
// It disables any previous profiling settings.
|
||||
//
|
||||
// Mutex profiling is a no-op before go1.8.
|
||||
func MutexProfile(p *Profile) { p.mode = mutexMode }
|
||||
|
||||
// BlockProfile enables block (contention) profiling.
|
||||
// It disables any previous profiling settings.
|
||||
func BlockProfile(p *Profile) { p.mode = blockMode }
|
||||
|
||||
// Trace profile controls if execution tracing will be enabled. It disables any previous profiling settings.
|
||||
func TraceProfile(p *Profile) { p.mode = traceMode }
|
||||
|
||||
// ProfilePath controls the base path where various profiling
|
||||
// files are written. If blank, the base path will be generated
|
||||
// by ioutil.TempDir.
|
||||
func ProfilePath(path string) func(*Profile) {
|
||||
return func(p *Profile) {
|
||||
p.path = path
|
||||
}
|
||||
}
|
||||
|
||||
// Stop stops the profile and flushes any unwritten data.
|
||||
func (p *Profile) Stop() {
|
||||
if !atomic.CompareAndSwapUint32(&p.stopped, 0, 1) {
|
||||
// someone has already called close
|
||||
return
|
||||
}
|
||||
p.closer()
|
||||
atomic.StoreUint32(&started, 0)
|
||||
}
|
||||
|
||||
// started is non zero if a profile is running.
|
||||
var started uint32
|
||||
|
||||
// Start starts a new profiling session.
|
||||
// The caller should call the Stop method on the value returned
|
||||
// to cleanly stop profiling.
|
||||
func Start(options ...func(*Profile)) interface {
|
||||
Stop()
|
||||
} {
|
||||
if !atomic.CompareAndSwapUint32(&started, 0, 1) {
|
||||
log.Fatal("profile: Start() already called")
|
||||
}
|
||||
|
||||
var prof Profile
|
||||
for _, option := range options {
|
||||
option(&prof)
|
||||
}
|
||||
|
||||
path, err := func() (string, error) {
|
||||
if p := prof.path; p != "" {
|
||||
return p, os.MkdirAll(p, 0777)
|
||||
}
|
||||
return ioutil.TempDir("", "profile")
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create initial output directory: %v", err)
|
||||
}
|
||||
|
||||
logf := func(format string, args ...interface{}) {
|
||||
if !prof.quiet {
|
||||
log.Printf(format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
switch prof.mode {
|
||||
case cpuMode:
|
||||
fn := filepath.Join(path, "cpu.pprof")
|
||||
f, err := os.Create(fn)
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create cpu profile %q: %v", fn, err)
|
||||
}
|
||||
logf("profile: cpu profiling enabled, %s", fn)
|
||||
pprof.StartCPUProfile(f)
|
||||
prof.closer = func() {
|
||||
pprof.StopCPUProfile()
|
||||
f.Close()
|
||||
logf("profile: cpu profiling disabled, %s", fn)
|
||||
}
|
||||
|
||||
case memMode:
|
||||
fn := filepath.Join(path, "mem.pprof")
|
||||
f, err := os.Create(fn)
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create memory profile %q: %v", fn, err)
|
||||
}
|
||||
old := runtime.MemProfileRate
|
||||
runtime.MemProfileRate = prof.memProfileRate
|
||||
logf("profile: memory profiling enabled (rate %d), %s", runtime.MemProfileRate, fn)
|
||||
prof.closer = func() {
|
||||
pprof.Lookup("heap").WriteTo(f, 0)
|
||||
f.Close()
|
||||
runtime.MemProfileRate = old
|
||||
logf("profile: memory profiling disabled, %s", fn)
|
||||
}
|
||||
|
||||
case mutexMode:
|
||||
fn := filepath.Join(path, "mutex.pprof")
|
||||
f, err := os.Create(fn)
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create mutex profile %q: %v", fn, err)
|
||||
}
|
||||
enableMutexProfile()
|
||||
logf("profile: mutex profiling enabled, %s", fn)
|
||||
prof.closer = func() {
|
||||
if mp := pprof.Lookup("mutex"); mp != nil {
|
||||
mp.WriteTo(f, 0)
|
||||
}
|
||||
f.Close()
|
||||
disableMutexProfile()
|
||||
logf("profile: mutex profiling disabled, %s", fn)
|
||||
}
|
||||
|
||||
case blockMode:
|
||||
fn := filepath.Join(path, "block.pprof")
|
||||
f, err := os.Create(fn)
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create block profile %q: %v", fn, err)
|
||||
}
|
||||
runtime.SetBlockProfileRate(1)
|
||||
logf("profile: block profiling enabled, %s", fn)
|
||||
prof.closer = func() {
|
||||
pprof.Lookup("block").WriteTo(f, 0)
|
||||
f.Close()
|
||||
runtime.SetBlockProfileRate(0)
|
||||
logf("profile: block profiling disabled, %s", fn)
|
||||
}
|
||||
|
||||
case traceMode:
|
||||
fn := filepath.Join(path, "trace.out")
|
||||
f, err := os.Create(fn)
|
||||
if err != nil {
|
||||
log.Fatalf("profile: could not create trace output file %q: %v", fn, err)
|
||||
}
|
||||
if err := startTrace(f); err != nil {
|
||||
log.Fatalf("profile: could not start trace: %v", err)
|
||||
}
|
||||
logf("profile: trace enabled, %s", fn)
|
||||
prof.closer = func() {
|
||||
stopTrace()
|
||||
logf("profile: trace disabled, %s", fn)
|
||||
}
|
||||
}
|
||||
|
||||
if !prof.noShutdownHook {
|
||||
go func() {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
<-c
|
||||
|
||||
log.Println("profile: caught interrupt, stopping profiles")
|
||||
prof.Stop()
|
||||
|
||||
os.Exit(0)
|
||||
}()
|
||||
}
|
||||
|
||||
return &prof
|
||||
}
|
||||
8
vendor/github.com/pkg/profile/trace.go
generated
vendored
Normal file
8
vendor/github.com/pkg/profile/trace.go
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// +build go1.7
|
||||
|
||||
package profile
|
||||
|
||||
import "runtime/trace"
|
||||
|
||||
var startTrace = trace.Start
|
||||
var stopTrace = trace.Stop
|
||||
10
vendor/github.com/pkg/profile/trace16.go
generated
vendored
Normal file
10
vendor/github.com/pkg/profile/trace16.go
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// +build !go1.7
|
||||
|
||||
package profile
|
||||
|
||||
import "io"
|
||||
|
||||
// mock trace support for Go 1.6 and earlier.
|
||||
|
||||
func startTrace(w io.Writer) error { return nil }
|
||||
func stopTrace() {}
|
||||
2
vendor/github.com/rivo/tview/README.md
generated
vendored
2
vendor/github.com/rivo/tview/README.md
generated
vendored
@@ -71,7 +71,7 @@ Add your issue here on GitHub. Feel free to get in touch if you have any questio
|
||||
- `Flex` and `Grid` don't clear their background per default, thus allowing for custom modals. See the [Wiki](https://github.com/rivo/tview/wiki/Modal) for an example.
|
||||
- v0.14 (2018-04-13)
|
||||
- Added an `Escape()` function which keep strings like color or region tags from being recognized as such.
|
||||
- Added `ANSIIWriter()` and `TranslateANSII()` which convert ANSII escape sequences to `tview` color tags.
|
||||
- Added `ANSIWriter()` and `TranslateANSI()` which convert ANSI escape sequences to `tview` color tags.
|
||||
- v0.13 (2018-04-01)
|
||||
- Added background colors and text attributes to color tags.
|
||||
- v0.12 (2018-03-13)
|
||||
|
||||
58
vendor/github.com/rivo/tview/ansii.go → vendor/github.com/rivo/tview/ansi.go
generated
vendored
58
vendor/github.com/rivo/tview/ansii.go → vendor/github.com/rivo/tview/ansi.go
generated
vendored
@@ -8,44 +8,44 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// The states of the ANSII escape code parser.
|
||||
// The states of the ANSI escape code parser.
|
||||
const (
|
||||
ansiiText = iota
|
||||
ansiiEscape
|
||||
ansiiSubstring
|
||||
ansiiControlSequence
|
||||
ansiText = iota
|
||||
ansiEscape
|
||||
ansiSubstring
|
||||
ansiControlSequence
|
||||
)
|
||||
|
||||
// ansii is a io.Writer which translates ANSII escape codes into tview color
|
||||
// ansi is a io.Writer which translates ANSI escape codes into tview color
|
||||
// tags.
|
||||
type ansii struct {
|
||||
type ansi struct {
|
||||
io.Writer
|
||||
|
||||
// Reusable buffers.
|
||||
buffer *bytes.Buffer // The entire output text of one Write().
|
||||
csiParameter, csiIntermediate *bytes.Buffer // Partial CSI strings.
|
||||
|
||||
// The current state of the parser. One of the ansii constants.
|
||||
// The current state of the parser. One of the ansi constants.
|
||||
state int
|
||||
}
|
||||
|
||||
// ANSIIWriter returns an io.Writer which translates any ANSII escape codes
|
||||
// ANSIWriter returns an io.Writer which translates any ANSI escape codes
|
||||
// written to it into tview color tags. Other escape codes don't have an effect
|
||||
// and are simply removed. The translated text is written to the provided
|
||||
// writer.
|
||||
func ANSIIWriter(writer io.Writer) io.Writer {
|
||||
return &ansii{
|
||||
func ANSIWriter(writer io.Writer) io.Writer {
|
||||
return &ansi{
|
||||
Writer: writer,
|
||||
buffer: new(bytes.Buffer),
|
||||
csiParameter: new(bytes.Buffer),
|
||||
csiIntermediate: new(bytes.Buffer),
|
||||
state: ansiiText,
|
||||
state: ansiText,
|
||||
}
|
||||
}
|
||||
|
||||
// Write parses the given text as a string of runes, translates ANSII escape
|
||||
// Write parses the given text as a string of runes, translates ANSI escape
|
||||
// codes to color tags and writes them to the output writer.
|
||||
func (a *ansii) Write(text []byte) (int, error) {
|
||||
func (a *ansi) Write(text []byte) (int, error) {
|
||||
defer func() {
|
||||
a.buffer.Reset()
|
||||
}()
|
||||
@@ -54,23 +54,23 @@ func (a *ansii) Write(text []byte) (int, error) {
|
||||
switch a.state {
|
||||
|
||||
// We just entered an escape sequence.
|
||||
case ansiiEscape:
|
||||
case ansiEscape:
|
||||
switch r {
|
||||
case '[': // Control Sequence Introducer.
|
||||
a.csiParameter.Reset()
|
||||
a.csiIntermediate.Reset()
|
||||
a.state = ansiiControlSequence
|
||||
a.state = ansiControlSequence
|
||||
case 'c': // Reset.
|
||||
fmt.Fprint(a.buffer, "[-:-:-]")
|
||||
a.state = ansiiText
|
||||
a.state = ansiText
|
||||
case 'P', ']', 'X', '^', '_': // Substrings and commands.
|
||||
a.state = ansiiSubstring
|
||||
a.state = ansiSubstring
|
||||
default: // Ignore.
|
||||
a.state = ansiiText
|
||||
a.state = ansiText
|
||||
}
|
||||
|
||||
// CSI Sequences.
|
||||
case ansiiControlSequence:
|
||||
case ansiControlSequence:
|
||||
switch {
|
||||
case r >= 0x30 && r <= 0x3f: // Parameter bytes.
|
||||
if _, err := a.csiParameter.WriteRune(r); err != nil {
|
||||
@@ -194,22 +194,22 @@ func (a *ansii) Write(text []byte) (int, error) {
|
||||
fmt.Fprintf(a.buffer, "[%s:%s%s]", foreground, background, attributes)
|
||||
}
|
||||
}
|
||||
a.state = ansiiText
|
||||
a.state = ansiText
|
||||
default: // Undefined byte.
|
||||
a.state = ansiiText // Abort CSI.
|
||||
a.state = ansiText // Abort CSI.
|
||||
}
|
||||
|
||||
// We just entered a substring/command sequence.
|
||||
case ansiiSubstring:
|
||||
case ansiSubstring:
|
||||
if r == 27 { // Most likely the end of the substring.
|
||||
a.state = ansiiEscape
|
||||
a.state = ansiEscape
|
||||
} // Ignore all other characters.
|
||||
|
||||
// "ansiiText" and all others.
|
||||
// "ansiText" and all others.
|
||||
default:
|
||||
if r == 27 {
|
||||
// This is the start of an escape sequence.
|
||||
a.state = ansiiEscape
|
||||
a.state = ansiEscape
|
||||
} else {
|
||||
// Just a regular rune. Send to buffer.
|
||||
if _, err := a.buffer.WriteRune(r); err != nil {
|
||||
@@ -227,11 +227,11 @@ func (a *ansii) Write(text []byte) (int, error) {
|
||||
return len(text), nil
|
||||
}
|
||||
|
||||
// TranslateANSII replaces ANSII escape sequences found in the provided string
|
||||
// TranslateANSI replaces ANSI escape sequences found in the provided string
|
||||
// with tview's color tags and returns the resulting string.
|
||||
func TranslateANSII(text string) string {
|
||||
func TranslateANSI(text string) string {
|
||||
var buffer bytes.Buffer
|
||||
writer := ANSIIWriter(&buffer)
|
||||
writer := ANSIWriter(&buffer)
|
||||
writer.Write([]byte(text))
|
||||
return buffer.String()
|
||||
}
|
||||
39
vendor/github.com/rivo/tview/form.go
generated
vendored
39
vendor/github.com/rivo/tview/form.go
generated
vendored
@@ -218,6 +218,25 @@ func (f *Form) AddButton(label string, selected func()) *Form {
|
||||
return f
|
||||
}
|
||||
|
||||
// RemoveButton removes the button at the specified position, starting with 0
|
||||
// for the button that was added first.
|
||||
func (f *Form) RemoveButton(index int) *Form {
|
||||
f.buttons = append(f.buttons[:index], f.buttons[index+1:]...)
|
||||
return f
|
||||
}
|
||||
|
||||
// GetButtonIndex returns the index of the button with the given label, starting
|
||||
// with 0 for the button that was added first. If no such label was found, -1
|
||||
// is returned.
|
||||
func (f *Form) GetButtonIndex(label string) int {
|
||||
for index, button := range f.buttons {
|
||||
if button.GetLabel() == label {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Clear removes all input elements from the form, including the buttons if
|
||||
// specified.
|
||||
func (f *Form) Clear(includeButtons bool) *Form {
|
||||
@@ -251,6 +270,14 @@ func (f *Form) GetFormItem(index int) FormItem {
|
||||
return f.items[index]
|
||||
}
|
||||
|
||||
// RemoveFormItem removes the form element at the given position, starting with
|
||||
// index 0. Elements are referenced in the order they were added. Buttons are
|
||||
// not included.
|
||||
func (f *Form) RemoveFormItem(index int) *Form {
|
||||
f.items = append(f.items[:index], f.items[index+1:]...)
|
||||
return f
|
||||
}
|
||||
|
||||
// GetFormItemByLabel returns the first form element with the given label. If
|
||||
// no such element is found, nil is returned. Buttons are not searched and will
|
||||
// therefore not be returned.
|
||||
@@ -263,6 +290,18 @@ func (f *Form) GetFormItemByLabel(label string) FormItem {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetFormItemIndex returns the index of the first form element with the given
|
||||
// label. If no such element is found, -1 is returned. Buttons are not searched
|
||||
// and will therefore not be returned.
|
||||
func (f *Form) GetFormItemIndex(label string) int {
|
||||
for index, item := range f.items {
|
||||
if item.GetLabel() == label {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// SetCancelFunc sets a handler which is called when the user hits the Escape
|
||||
// key.
|
||||
func (f *Form) SetCancelFunc(callback func()) *Form {
|
||||
|
||||
8
vendor/github.com/xanzy/go-gitlab/tags.go
generated
vendored
8
vendor/github.com/xanzy/go-gitlab/tags.go
generated
vendored
@@ -93,7 +93,7 @@ func (s *TagsService) GetTag(pid interface{}, tag string, options ...OptionFunc)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), tag)
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), url.QueryEscape(tag))
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
if err != nil {
|
||||
@@ -154,7 +154,7 @@ func (s *TagsService) DeleteTag(pid interface{}, tag string, options ...OptionFu
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), tag)
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s", url.QueryEscape(project), url.QueryEscape(tag))
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
if err != nil {
|
||||
@@ -182,7 +182,7 @@ func (s *TagsService) CreateRelease(pid interface{}, tag string, opt *CreateRele
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), tag)
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), url.QueryEscape(tag))
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
if err != nil {
|
||||
@@ -215,7 +215,7 @@ func (s *TagsService) UpdateRelease(pid interface{}, tag string, opt *UpdateRele
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), tag)
|
||||
u := fmt.Sprintf("projects/%s/repository/tags/%s/release", url.QueryEscape(project), url.QueryEscape(tag))
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user