say

package
v0.0.0-...-0730a73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package say contains SayCmd which returns a random sentence using hitokoto api.

Index

Constants

This section is empty.

Variables

View Source
var SayCmd = &cobra.Command{
	Use:   "say",
	Short: "Say something(# ̄▽ ̄#)",
	Long:  "Hi Jarvis, say something please(# ̄▽ ̄#)",
	Run: func(cmd *cobra.Command, args []string) {
		s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
		s.Start()
		res, err := http.Get("https://v1.hitokoto.cn/?encode=text")
		s.Stop()
		utils.ExitOnError(err)
		defer res.Body.Close()
		contents, err := ioutil.ReadAll(res.Body)
		utils.ExitOnError(err)
		fmt.Printf("%s\n", string(contents))
	},
}

SayCmd returns a random sentence using hitokoto api.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL