chapter7

package
v0.0.0-...-1140a65 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package chapter7, Interfaces, defines bytes, words and line counter writer interfaces that can be used as part of fmt methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CelsiusFlag

func CelsiusFlag(name string, value tempConv.Celsius, usage string, set *flag.FlagSet) *tempConv.Celsius

CelsiusFlag creates a custom flag

func CountCharsWordsLines

func CountCharsWordsLines(r io.Reader) (int, int, int)

CountCharsWordsLines reads from a reader and returns count of

characters words and lines

func CountingWriter

func CountingWriter(w io.Writer) (io.Writer, *int64)

CountingWriter intercept a writer and count bytes written to it

func FahrenheitFlag

func FahrenheitFlag(name string, value tempConv.Fahrenheit, usage string, set *flag.FlagSet) *tempConv.Fahrenheit

FahrenheitFlag creates a custom flag

func InitCli

func InitCli()

InitCli initialized CLIDegrees for temperature conversions, eg:

the-gpl degrees -c=-20°F -f-20°C -k=-20°K

func KelvinFlag

func KelvinFlag(name string, value tempConv.Kelvin, usage string, set *flag.FlagSet) *tempConv.Kelvin

KelvinFlag creates a custom flag

Types

type BroadcastWriters

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

BroadcastWriters sequentially writes to writers in linked list

func NewBroadcastWriters

func NewBroadcastWriters(writers ...io.Writer) *BroadcastWriters

NewBroadcastWriters creates a broadcast list of Writers

func (*BroadcastWriters) Write

func (c *BroadcastWriters) Write(p []byte) (int, error)

Write calls the Writers in sequence

type ByteCounter

type ByteCounter int

ByteCounter writer interface counts number of bytes written to it

func (*ByteCounter) Write

func (c *ByteCounter) Write(p []byte) (int, error)

Write to a ByteCounter interface

type CLICounter

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

CLICounter wrapper for *flag.FlagSet for CountCharsWordsLines

func (CLICounter) DisplayHelp

func (t CLICounter) DisplayHelp()

func (CLICounter) ExecCmd

func (t CLICounter) ExecCmd(args []string)

ExecCmd executed degrees

type CLIDegrees

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

CLIDegrees wrapper for *flag.FlagSet for tempConv

func (CLIDegrees) DisplayHelp

func (t CLIDegrees) DisplayHelp()

func (CLIDegrees) ExecCmd

func (t CLIDegrees) ExecCmd(args []string)

ExecCmd executed degrees

type CountWriter

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

CountWriter intercepts an io.Writer and counts numbers of characters written to it

func (*CountWriter) Write

func (c *CountWriter) Write(p []byte) (int, error)

Write define the counting "Write interface" interface

type LineCounter

type LineCounter int

LineCounter writer interface counts number of lines written to it

func (*LineCounter) Write

func (c *LineCounter) Write(p []byte) (int, error)

Write to a LineCounter interface

type WordCounter

type WordCounter int

WordCounter writer interface counts number of words written to it

func (*WordCounter) Write

func (c *WordCounter) Write(p []byte) (int, error)

Write to a WordCounter interface

Jump to

Keyboard shortcuts

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