Giter Site home page Giter Site logo

github-nippou's Introduction

github-nippou

Test Go Report Card Go Reference

Print today's your GitHub activity for issues and pull requests.

This is a helpful CLI when you write a daily report in reference to GitHub. Nippou is a japanese word which means a daily report.

A web version of this CLI is also available at https://github.com/MH4GF/github-nippou-web .

Installation

Grab the latest binary from the releases page.

On macOS you can install or upgrade to the latest released version with Homebrew:

$ brew install masutaka/tap/github-nippou
$ brew upgrade github-nippou

If you're interested in hacking on github-nippou, you can install via go install:

$ go install github.com/masutaka/github-nippou/v4@latest

Also you can use make command, it's easy to build github-nippou:

$ make deps
$ make
$ ./github-nippou

Setup

$ github-nippou init

The initialization will be update your Git global configuration file.

  1. Add github-nippou.user
  2. Add github-nippou.token
  3. Create Gist, and add github-nippou.settings-gist-id for customizing output format (optional)

Usage

$ github-nippou help
Print today's your GitHub activity for issues and pull requests

Usage:
  github-nippou [flags]
  github-nippou [command]

Available Commands:
  completion    Generate the autocompletion script for the specified shell
  help          Help about any command
  init          Initialize github-nippou settings
  list          Print today's your GitHub activity for issues and pull requests
  open-settings Open settings url with web browser
  version       Print version

Flags:
  -d, --debug               Debug mode
  -h, --help                help for github-nippou
  -s, --since-date string   Retrieves GitHub user_events since the date (default "20231028")
  -u, --until-date string   Retrieves GitHub user_events until the date (default "20231028")

Use "github-nippou [command] --help" for more information about a command.

You can get your GitHub Nippou on today.

$ github-nippou

### masutaka/github-nippou

* [v3.0.0](https://github.com/masutaka/github-nippou/issues/59) by @[masutaka](https://github.com/masutaka)
* [Enable to inject settings_gist_id instead of the settings](https://github.com/masutaka/github-nippou/pull/63) by @[masutaka](https://github.com/masutaka) **merged!**
* [Add y/n prompt to sub command \`init\`](https://github.com/masutaka/github-nippou/pull/64) by @[masutaka](https://github.com/masutaka) **merged!**
* [Add sub command \`open-settings\`](https://github.com/masutaka/github-nippou/pull/65) by @[masutaka](https://github.com/masutaka) **merged!**
* [Dockerize](https://github.com/masutaka/github-nippou/pull/66) by @[masutaka](https://github.com/masutaka) **merged!**

Optional: Customize Output Format

Customize the list output format as needed. Configurations are stored in a Gist.
Running github-nippou init creates your Gist and adds its ID to github-nippou.settings-gist-id.

View the default configuration here.

Available Properties

format.subject

Property Type Description
subject string Represents the repository name.

format.line

Property Type Description
user string Displays the username of author of the issue or pull request.
title string Displays the title of the issue or pull request.
url string Displays the URL of the issue or pull request.
status string | nil Displays the status, utilizing the format in dictionary.status.

format.dictionary.status

Property Type Description
closed string Displays when the issue or pull request is closed.
merged string Displays when the pull request is merged. Applicable to pull requests only.

Contributing

  1. Fork it ( https://github.com/masutaka/github-nippou/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

External articles

In Japanese

  1. いつも日報書くときに使っているスクリプトをGem化した | マスタカの ChangeLog メモ
  2. github-nippou v0.1.1 released | マスタカの ChangeLog メモ
  3. github-nippou v1.1.0 and v1.1.1 released | マスタカの ChangeLog メモ
  4. github-nippou v1.2.0 released | マスタカの ChangeLog メモ
  5. 社内勉強会で github-nippou v2.0.0 をライブリリースした | マスタカの ChangeLog メモ
  6. github-nippou v3.0.0 released | マスタカの ChangeLog メモ
  7. github-nippou という gem を golang で書き直したという発表をした - Feedforce Developer Blog
  8. github-nippou を golang で書き換えて v4.0.1 リリースしてました | マスタカの ChangeLog メモ
  9. github-nippou のリリースを gox+ghr の手動実行から、tagpr+goreleaser の自動実行に変えた | マスタカの ChangeLog メモ
  10. github-nippou の Web 版を App Router + Go + Vercel で作った | Hirotaka Miyagi

github-nippou's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar deppbot avatar github-actions[bot] avatar masutaka avatar mattn avatar mh4gf avatar ryz310 avatar tsub avatar yono avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

github-nippou's Issues

Proposal: ライブラリとしてのユースケースをサポート

こんにちは!
私はgithub-nippouのファンで、CLIが不慣れな方でも使えるようgithub-nippouをブラウザで利用できるツール https://github-nippou-web.vercel.app/ の開発を進めています。
リポジトリはこちらです: https://github.com/MH4GF/github-nippou-web
GoのAPIサーバーとNext.jsで構築しています。

元々のgithub-nippouはCLIツールとして提供していましたが、github-nippouをライブラリとして利用し、APIサーバーから呼び出すとなると、いくつか処理を調整したい箇所がありました。

サンプル実装がこちらです: master...MH4GF:github-nippou:poc-programable-usage

提案内容

lib.List() の処理内容を調整し、いくつかを RootCmd.Run に移動したい

ライブラリとして lib.List() を使うことができるように、いくつか処理を調整したいです。以下ができるとユースケースを満たすことができそうです。

  • IO処理を lib.List() から取り除き、呼び出し元で処理する
    • 結果を fmt.Print() で出力する処理は lib.List() では行わず、stringを返す
    • エラー発生時に log.Fatal() を使わずerrを返す
  • git configや環境変数以外の認証情報の取得方法として、 lib.List() の引数として渡せるようにする
    • HTTPリクエストに含まれる情報を利用して認証情報を設定したいためです。

lib.List() のインターフェースを調整したい

上記の調整を行うためにはインターフェースを変える必要がありそうで、以下の形を提案させてください。

type ListOptions struct {
	SinceDate string
	UntilDate string
	Debug     bool
}

type Config struct {
	User           string
	AccessToken    string
	SettingsGistId string
}

func List(options ListOptions, config Config) (string error)

すでにSettings structがあるなかでoption/configという命名をするのは微妙かも...?とも思うのですが、こちらは議論できると嬉しいです。
現在のgithub-nippouはCLI経由からの利用しかないため、 lib.List() のインターフェースを変更したとしても破壊的変更はないはずです。


上記の提案について議論できると嬉しいです!方針が固まれば、喜んでPRを提出します。
よろしくお願いします!

設定を ~/.config/git/config から他のファイルに移す

GitHub の Credential を $ github-nippou init~/.config/git/config (or ~/.gitconfig) に書き込むのは、誰かにその設定ファイルを共有した時、漏洩してしまう観点から良くなかった。

~/.config/github-nippou/config.yml などの独自設定ファイルに移す。peco が参考になるかも。

https://github.com/peco/peco/blob/v0.5.11/config.go#L181-L222

// Try in this order:
// $XDG_CONFIG_HOME/peco/config.json
// $XDG_CONFIG_DIR/peco/config.json (where XDG_CONFIG_DIR is listed in $XDG_CONFIG_DIRS)
// ~/.peco/config.json

ライブラリとして利用する場合v4.0.4以上のバージョンが利用できない

github-nippouを別のGoプログラムから利用する際、以下のような挙動となります。

# バージョン指定なしでgo getする場合、v4.0.4がダウンロードされ、かつ +incompatible が付く
$ go get github.com/masutaka/github-nippou
go: added github.com/masutaka/github-nippou v4.0.4+incompatible

# 最新バージョンのv4.2.7を指定すると以下のエラーが発生し失敗する
$ go get github.com/masutaka/[email protected]
go: github.com/masutaka/[email protected]: invalid version: module contains a go.mod file, so module path must match major version ("github.com/masutaka/github-nippou/v4")

proxy.golang.org/を見るとgo getでダウンロード可能なバージョンの一覧を見ることができますが、そこではやはりv4.0.4以降のバージョンは記載されていません。
https://proxy.golang.org/github.com/masutaka/github-nippou/@v/list

v4.0.4の次バージョンであるv4.1.0では、depからGo moduleへの移行が行われています。
#77

達成したいこと

v4.2.7のバージョンや、それ以降のバージョンをgo getで利用できるようにしたいです。
別の解決策として、 go get github.com/masutaka/github-nippou@972d70e87d57346fb1b9ec0bdb7664692c7e2efd のようにコミットハッシュで指定すれば利用できますが、バージョン管理ができないのは望ましくないはずです。

参考

v3.0.0

  • travis-ci 設定
  • settings 用 class を作る
  • サブコマンド init を Interactive にする
  • ENV['GITHUB_NIPPOU_SETTINGS'] 処理の削除
  • ~/.gitconfig に github-nippou.settings を設定できる機能の削除
  • サブコマンド open-settings を作る
  • Dockerize して Docker Hub で automated build する
  • README.md アップデート
    • 使い方
    • 以前と同じ書式に出来たら設定を書く
    • GitHub Personal Access Token に必要なパーミッション(Github::Nippou::Commands#access_token と両方必要?)
      • → エラー時のメッセージでいい感じに出すようにした

Customizable output format

2.0.0

This version has fixed format.

* [title - repo_name1](url) by user (optional: status)
* [title - repo_name1](url) by user (optional: status)
* [title - repo_name2](url) by user (optional: status)

2.1.0.beta1

Add grouping.

### repo_name1

* [title](url) by user (optional: status)
* [title](url) by user (optional: status)

### repo_name2

* [title](url) by user (optional: status)

v2.1.0 ?

User can customize the formats of rep_name, title and status?

READMEにGistによる設定の説明が欲しい

フォーマットのカスタマイズ機能は強力ですが、その設定内容がドキュメント化されていないのはもったいないと感じました。以下の内容がREADMEに記載されているとよさそうです。

  • 作成方法(github-nippou init)
  • デフォルトの設定
  • 利用可能なプロパティ

init 時に panic になる

Are you sure? [y/n] で、ただ [return] すると panic になる。y[return]n[return] が前提のコードになっている。

$ github-nippou init
** github-nippou Initialization **

== [Step: 1/3] GitHub user ==

What's your GitHub account? masutaka

The following command will be executed.

    $ git config --global github-nippou.user masutaka

Are you sure? [y/n] 
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/masutaka/github-nippou/lib.setUser()
        /Users/masutaka/src/github.com/masutaka/github-nippou/lib/init.go:58 +0x36c
github.com/masutaka/github-nippou/lib.Init()
        /Users/masutaka/src/github.com/masutaka/github-nippou/lib/init.go:15 +0x58
github.com/masutaka/github-nippou/cmd.glob..func1(0x140000e0900?, {0x104d9d967?, 0x4?, 0x104d9d893?})
        /Users/masutaka/src/github.com/masutaka/github-nippou/cmd/init.go:15 +0x1c
github.com/spf13/cobra.(*Command).execute(0x1051a0900, {0x1051db2e0, 0x0, 0x0})
        /Users/masutaka/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x1051a0ec0)
        /Users/masutaka/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x14000056728?)
        /Users/masutaka/go/pkg/mod/github.com/spf13/[email protected]/command.go:992 +0x1c
main.main()
        /Users/masutaka/src/github.com/masutaka/github-nippou/main.go:13 +0x24

macOS Sierra で brew install に失敗する

https://github.com/masutaka/github-nippou/releases/download/v4.0.0/github-nippou_darwin_amd64.gz が 404 を返すようです

brew install masutaka/github-nippou/github-nippou
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (caskroom/cask, homebrew/core).
==> Updated Formulae
awscli ✔                                                                                                                cmake ✔

==> Tapping masutaka/github-nippou
Cloning into '/usr/local/Homebrew/Library/Taps/masutaka/homebrew-github-nippou'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
Tapped 1 formula (30 files, 23.1KB)
==> Installing github-nippou from masutaka/github-nippou
==> Downloading https://github.com/masutaka/github-nippou/releases/download/v4.0.0/github-nippou_darwin_amd64.gz

curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "github-nippou"
Download failed: https://github.com/masutaka/github-nippou/releases/download/v4.0.0/github-nippou_darwin_amd64.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.