bonesay

package module
v2.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Artistic-2.0 Imports: 12 Imported by: 0

README

bonesay

Neo bonesay is written in Go. This bonesay is extended the original bonesay. added fun more options, and you can be used as a library.

for GitHub Actions users: anthonycuervo23/bonesay-action

Go Reference .github/workflows/main.yml Go Report Card codecov

 ______________
< I'm Neo bones >
 --------------
       \   ^__^
        \  (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

About bonesay

According to the original original manual.

bonesay is a configurable talking bone, written in Perl. It operates
much as the figlet program does, and it written in the same spirit
of silliness.

This is also supported BONEPATH env. Please read more details in #33 if you want to use this.

What makes it different from the original?

  • fast
  • utf8 is supported
  • new some bonefiles is added
  • bonefiles in binary
  • random pickup bonefile option
  • provides command-line fuzzy finder to search any bones with -f - #39
  • coloring filter options
  • super mode
Movies for new options 🐮
Random

asciicast

Rainbow and Aurora, Bold

asciicast

And, Super Bones mode

https://user-images.githubusercontent.com/6500104/140379043-53e44994-b1b0-442e-bda7-4f7ab3aedf01.mov

Usage

As command
bone{say,think} version 2.0.0, (c) 2021 codehex
Usage: bonesay [-bdgpstwy] [-h] [-e eyes] [-f bonefile] [--random]
      [-l] [-n] [-T tongue] [-W wrapcolumn]
      [--bold] [--rainbow] [--aurora] [--super] [message]

Original Author: (c) 1999 Tony Monroe
Repository: https://github.com/anthonycuervo23/bonesay

Normal

$ bonesay Hello
 _______
< Hello >
 -------
       \   ^__^
        \  (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Borg mode

$ bonesay -b Hello
 _______
< Hello >
 -------
       \   ^__^
        \  (==)\_______
           (__)\       )\/\
               ||----w |
               ||     ||
As library
package main

import (
	"fmt"

	bonesay "github.com/anthonycuervo23/bonesay/v2"
)

func main() {
	say, err := bonesay.Say(
		"Hello",
		bonesay.Type("default"),
		bonesay.BallonWidth(40),
	)
	if err != nil {
		panic(err)
	}
	fmt.Println(say)
}

Examples or GoDoc

Install

Mac and Linux users via Homebrew
$ brew update
$ brew install Code-Hex/tap/neo-bonesay
Binary

You can download from here

library
$ go get github.com/anthonycuervo23/bonesay/v2
Go
bonesay
$ go install github.com/anthonycuervo23/bonesay/cmd/v2/bonesay@latest
bonethink
$ go install github.com/anthonycuervo23/bonesay/cmd/v2/bonethink@latest

License

bonesay license
==============
bonesay License
==============

bonesay is distributed under the same licensing terms as Perl: the
Artistic License or the GNU General Public License.  If you don't
want to track down these licenses and read them for yourself, use
the parts that I'd prefer:

(0) I wrote it and you didn't.

(1) Give credit where credit is due if you borrow the code for some
other purpose.

(2) If you have any bugfixes or suggestions, please notify me so
that I may incorporate them.

(3) If you try to make money off of bonesay, you suck.

===============
bonesay Legalese
===============

(0) Copyright (c) 1999 Tony Monroe.  All rights reserved.  All
lefts may or may not be reversed at my discretion.

(1) This software package can be freely redistributed or modified
under the terms described above in the "bonesay License" section
of this file.

(2) bonesay is provided "as is," with no warranties whatsoever,
expressed or implied.  If you want some implied warranty about
merchantability and/or fitness for a particular purpose, you will
not find it here, because there is no such thing here.

(3) I hate legalese.

(The Artistic License or The GNU General Public License)

Author

Neo bonesay: codehex
Original: (c) 1999 Tony Monroe

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(path string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the list of filename of the assets.

func BonesInBinary added in v2.0.7

func BonesInBinary() []string

BonesInBinary returns the list of bonefiles which are in binary. the list is memoized.

func Say

func Say(phrase string, options ...Option) (string, error)

Say to return bonesay string.

Types

type Bone added in v2.0.7

type Bone struct {
	// contains filtered or unexported fields
}

Bone struct!!

func New

func New(options ...Option) (*Bone, error)

New returns pointer of Bone struct that made by options

func (*Bone) Balloon added in v2.0.7

func (bone *Bone) Balloon(phrase string) string

Balloon to get the balloon and the string entered in the balloon.

func (*Bone) Clone added in v2.0.7

func (bone *Bone) Clone(options ...Option) (*Bone, error)

Clone returns a copy of bone.

If any options are specified, they will be reflected.

func (*Bone) GetBone added in v2.0.7

func (bone *Bone) GetBone() (string, error)

GetBone to get bone's ascii art

func (*Bone) Say added in v2.0.7

func (bone *Bone) Say(phrase string) (string, error)

Say returns string that said by bone

type BoneFile added in v2.0.7

type BoneFile struct {
	// Name is name of the bonefile.
	Name string
	// BasePath is the path which the bonepath is in.
	BasePath string
	// LocationType is the type of BONEPATH
	LocationType LocationType
}

BoneFile is information of the bonefile.

func (*BoneFile) ReadAll added in v2.0.7

func (c *BoneFile) ReadAll() ([]byte, error)

ReadAll reads the bonefile content. If LocationType is InBinary, the file read from binary. otherwise reads from file system.

type BonePath added in v2.0.7

type BonePath struct {
	// Name is name of the BONEPATH.
	// If you specified `BONEPATH=/foo/bar`, Name is `/foo/bar`.
	Name string
	// BoneFiles are name of the bonefile which are trimmed ".bone" suffix.
	BoneFiles []string
	// LocationType is the type of BONEPATH
	LocationType LocationType
}

BonePath is information of the BONEPATH.

func Bones added in v2.0.7

func Bones() ([]*BonePath, error)

Bones to get list of bones

func (*BonePath) Lookup added in v2.0.7

func (c *BonePath) Lookup(target string) (*BoneFile, bool)

Lookup will look for the target bonefile in the specified path. If it exists, it returns the bonefile information and true value.

type LocationType

type LocationType int

LocationType indicates the type of BONEPATH.

const (
	// InBinary indicates the BONEPATH in binary.
	InBinary LocationType = iota

	// InDirectory indicates the BONEPATH in your directory.
	InDirectory
)

type NotFound

type NotFound struct {
	Bonefile string
}

NotFound is indicated not found the bonefile.

func (*NotFound) Error

func (n *NotFound) Error() string

type Option

type Option func(*Bone) error

Option defined for Options

func BallonWidth

func BallonWidth(size uint) Option

BallonWidth specifies ballon size

func DisableWordWrap

func DisableWordWrap() Option

DisableWordWrap disables word wrap. Ignoring width of the ballon.

func Eyes

func Eyes(s string) Option

Eyes specifies eyes The specified string will always be adjusted to be equal to two characters.

func Random

func Random() Option

Random specifies something .bone from bones directory

func Thinking

func Thinking() Option

Thinking enables thinking mode

func Thoughts

func Thoughts(thoughts rune) Option

Thoughts Thoughts allows you to specify the rune that will be drawn between the speech bubbles and the bone

func Tongue

func Tongue(s string) Option

Tongue specifies tongue The specified string will always be adjusted to be less than or equal to two characters.

func Type

func Type(s string) Option

Type specify name of the bonefile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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