flip

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 1 Imported by: 1

README

flip (╯°□°)╯︵ʇxǝʇ

Go library used to flip text.

Build status Go Report Card GoDoc License MIT

Command line tool

Installation
go install github.com/peterhellberg/flip/cmd/flip@latest
Usage

You can flip a string on its own or decorate it with a named emoticon

flip foo        #=> ooɟ
flip table bar  #=> (╯°□°)╯︵ɹɐq
flip gopher baz #=> ʕ╯◔ϖ◔ʔ╯︵zɐq

You can also specify a custom emoticon

flip '(#`д´)ノ︵' baz  #=> (#`д´)ノ︵zɐq

Examples

table.go
package main

import (
	"fmt"
	"os"
	"strings"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.Table(strings.Join(os.Args[1:], " ")))
}

License (MIT)

Copyright (C) 2014-2023 Peter Hellberg

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Overview

Package flip (╯°□°)╯︵ʇxǝʇ

Go library used to flip text.

Installation

Just go get the package:

go get -u github.com/peterhellberg/flip

Usage

A small usage example

package main

import (
	"fmt"
	"os"
	"strings"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.Table(strings.Join(os.Args[1:], " ")))
}

Index

Examples

Constants

View Source
const (
	// DefaultEmoticon is the default emoticon used to flip tables
	DefaultEmoticon = "(╯°□°)╯︵"

	// GopherEmoticon is the gopher emoticon used to do a gopher flip
	GopherEmoticon = "ʕ╯◔ϖ◔ʔ╯︵"

	// AngryEmoticon is an angry emoticon used to angrily flip the table
	AngryEmoticon = "(ノಠ益ಠ)ノ︵"

	// SparklyEmoticon is a very sparkly emoticon used to flip the table
	SparklyEmoticon = "(ノ◕ヮ◕)ノ*:・゚✧*:・゚✧ "
)

Variables

View Source
var (
	// Table is the default table flipper func
	Table = Func(DefaultEmoticon)

	// Gopher is the gopher table flipper func
	Gopher = Func(GopherEmoticon)

	// Angry is the angry table flipper func
	Angry = Func(AngryEmoticon)

	// Sparkly is the sparkly table flipper func
	Sparkly = Func(SparklyEmoticon)

	// Flippers is a map of named flipper funcs
	Flippers = map[string]func(string) string{
		"table":   Table,
		"gopher":  Gopher,
		"angry":   Angry,
		"sparkly": Sparkly,
	}
)

Functions

func Func

func Func(s string) func(string) string

Func returns a flipper func

Example
package main

import (
	"fmt"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.Func("(O_o/︵")("example"))
}
Output:
(O_o/︵ǝןdɯɐxǝ

func Reverse

func Reverse(s string) string

Reverse reverses the given string

Example
package main

import (
	"fmt"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.Reverse("foo bar"))
}
Output:
rab oof

func UpsideDown

func UpsideDown(s string) string

UpsideDown turns the given string upside down

Example
package main

import (
	"fmt"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.UpsideDown("example"))
}
Output:
ǝןdɯɐxǝ

Types

type Flipper

type Flipper string

Flipper is a string that decorates a flipped string

Example
package main

import (
	"fmt"

	"github.com/peterhellberg/flip"
)

func main() {
	fmt.Println(flip.Flippers["angry"]("example"))
}
Output:
(ノಠ益ಠ)ノ︵ǝןdɯɐxǝ

func (Flipper) Flip

func (f Flipper) Flip(s string) string

Flip flips and decorates a string

Directories

Path Synopsis
cmd
flip command
flip (╯°□°)╯︵ʇxǝʇ
flip (╯°□°)╯︵ʇxǝʇ

Jump to

Keyboard shortcuts

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