Skip to content

Commit

Permalink
Fix broken text in window os.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjbae1212 committed Feb 20, 2020
1 parent ec3db68 commit bc340d6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Because github site doesn't officially support to search for it in README.
> Notice that **FindGS** makes internally caching db and indexing in local.
> Because Github API is limited 5000 per hourly, so it's required something for caching and for searching with higher performance.
> And **FindGS** updates cached data an interval of 1 hour when running it.
> **If you have had starred repositories more than 5000**, you should run findgs an interval of 1 hour.(Github API is limited 5000 per hourly)
> As a result, All of starred repositories can store caching db and indexing in local.
It's implemented using **Golang**.
<br/> <br/>
Expand Down Expand Up @@ -52,10 +54,10 @@ $ brew tap gjbae1212/findgs
$ brew install findgs

# linux
$ wget https://github.com/gjbae1212/findgs/releases/download/v1.0.1/findgs_1.0.1_Linux_x86_64.tar.gz
$ wget https://github.com/gjbae1212/findgs/releases/download/v1.0.2/findgs_1.0.2_Linux_x86_64.tar.gz

# window
$ wget https://github.com/gjbae1212/findgs/releases/download/v1.0.1/findgs_1.0.1_Windows_x86_64.tar.gz
$ wget https://github.com/gjbae1212/findgs/releases/download/v1.0.2/findgs_1.0.2_Windows_x86_64.tar.gz
```
<br/>

Expand All @@ -79,14 +81,14 @@ $ findgs run -t your-github-token
**1. search**
This command searches your starred repositories using input text. Also it's to support wildcard searching.
```bash
>> search <search for text(ex hello*, aws cli ...)>
>> search [searhing text(ex cli tool, hello* ...)]
```

**2. open**
This command show your selected repository to browser.
```bash
>> open name <searched repositories name>
>> open num <searched column num>
>> open name [searched repositories name]
>> open num [searched column num]
```

**3. list**
Expand Down
14 changes: 8 additions & 6 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"strings"
"time"

prompt "github.com/c-bata/go-prompt"
"github.com/briandowns/spinner"
"github.com/inancgumus/screen"
prompt "github.com/c-bata/go-prompt"
"github.com/fatih/color"
"github.com/gjbae1212/findgs/search"
"github.com/mattn/go-colorable"
"github.com/olekukonko/tablewriter"
"github.com/pkg/browser"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -76,8 +78,8 @@ func preRun() execCommand {

func run() execCommand {
return func(cmd *cobra.Command, args []string) {
fmt.Println("\033[2J")
fmt.Print("\033[H")
screen.Clear()
screen.MoveTopLeft()
total, _ := searcher.TotalDoc()
color.Green("Indexing %d", total)
color.Green("Searching repositories equal to or higher %.3f score", minScore)
Expand Down Expand Up @@ -256,13 +258,13 @@ func executor(t string) {

func showSearchedList() {
// clear terminal.
fmt.Println("\033[2J")
fmt.Print("\033[H")
screen.Clear()
screen.MoveTopLeft()
color.Green("[search][text] \"%s\"", recentlySearchKeyword)
fmt.Println()

// table writer
table := tablewriter.NewWriter(os.Stdout)
table := tablewriter.NewWriter(colorable.NewColorableStdout())
table.SetHeader([]string{"NUM", "SCORE", "NAME", "URL", "TOPIC", "DESCRIPTION"})
table.SetFooter([]string{"", "", "", "", "TOTAL", fmt.Sprintf("%d", len(foundList))})
table.SetBorder(false)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ require (
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/fatih/color v1.9.0
github.com/google/go-github/v29 v29.0.3
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/mattn/go-colorable v0.1.4
github.com/mattn/go-runewidth v0.0.8 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/mitchellh/go-homedir v1.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDG
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3 h1:fO9A67/izFYFYky7l1pDP5Dr0BTCRkaQJUG6Jm5ehsk=
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3/go.mod h1:Ey4uAp+LvIl+s5jRbOHLcZpUDnkjLBROl15fZLwPlTM=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
Expand Down
2 changes: 1 addition & 1 deletion search/searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (s *searcher) CreateIndex() error {
newStarred.FullName, newStarred.PushedAt.Format(time.RFC3339))
} else {
if oldStarred.PushedAt.Unix() != newStarred.PushedAt.Unix() &&
oldStarred.CachedAt.Unix() < time.Now().Add(-24*time.Hour).Unix() {
oldStarred.CachedAt.Unix() < time.Now().Add(-24*7*time.Hour).Unix() { // after 7 days.
updateList = append(updateList, newStarred)
color.White("[update] %s repository pushed_at %s",
newStarred.FullName, newStarred.PushedAt.Format(time.RFC3339))
Expand Down

0 comments on commit bc340d6

Please sign in to comment.