mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-03 04:27:21 -05:00
58aaa17e7e
``` $ tea issue 230 #230 issue/pull details: show reactions (open) @6543 created 2020-10-22 16:39 since reactions are utf8 now and most terminals too, we can display them nicely :) https://gitea.com/api/v1/repos/gitea/tea/issues/230/reactions -------- 1x 🎉 | 1x 👀 | 1x | 1x 👍 | 1x 👎 | 1x 😆 | 1x 😕 | 1x ❤️ ``` caveats: - reactions are not returned as UTF8 (as was claimed in #230), so they need to be parsed. the library I use doesn't (and can't → ) support all reactions available in gitea - currently only for issues, as reactions for comments mean an additional API request for each comment.. fixes #230 Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/421 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package emoji
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
// Sprint wraps fmt.Sprint with emoji support
|
|
func Sprint(a ...interface{}) string {
|
|
return Parse(fmt.Sprint(a...))
|
|
}
|
|
|
|
// Sprintf wraps fmt.Sprintf with emoji support
|
|
func Sprintf(format string, a ...interface{}) string {
|
|
return Parse(fmt.Sprintf(format, a...))
|
|
}
|
|
|
|
// Sprintln wraps fmt.Sprintln with emoji support
|
|
func Sprintln(a ...interface{}) string {
|
|
return Parse(fmt.Sprintln(a...))
|
|
}
|
|
|
|
// Print wraps fmt.Print with emoji support
|
|
func Print(a ...interface{}) (n int, err error) {
|
|
return fmt.Print(Sprint(a...))
|
|
}
|
|
|
|
// Println wraps fmt.Println with emoji support
|
|
func Println(a ...interface{}) (n int, err error) {
|
|
return fmt.Println(Sprint(a...))
|
|
}
|
|
|
|
// Printf wraps fmt.Printf with emoji support
|
|
func Printf(format string, a ...interface{}) (n int, err error) {
|
|
return fmt.Print(Sprintf(format, a...))
|
|
}
|
|
|
|
// Fprint wraps fmt.Fprint with emoji support
|
|
func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
|
|
return fmt.Fprint(w, Sprint(a...))
|
|
}
|
|
|
|
// Fprintf wraps fmt.Fprintf with emoji support
|
|
func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
|
|
return fmt.Fprint(w, Sprintf(format, a...))
|
|
}
|
|
|
|
// Fprintln wraps fmt.Fprintln with emoji support
|
|
func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
|
|
return fmt.Fprintln(w, Sprint(a...))
|
|
}
|
|
|
|
// Errorf wraps fmt.Errorf with emoji support
|
|
func Errorf(format string, a ...interface{}) error {
|
|
return fmt.Errorf(Sprintf(format, a...))
|
|
}
|