Documentation
¶
Index ¶
- Constants
- Variables
- func Config(path string, table ConfigBlock) map[string]any
- func Dos2Unix(filename string) error
- func Examples(example string, cmdName ...string) string
- func GenerateQRCode(content string, size int, dest string) error
- func HTTPRequestContent(url string, body io.Reader, methods ...string) ([]byte, error)
- func HTTPRequestContentGB18030(url string, body io.Reader, methods ...string) ([]byte, error)
- func HTTPRequestRedirectURL(uri string) (string, error)
- func HashAlgorithm(alg string) hash.Hash
- func ReadQRCode(filename string) (string, error)
- func Usage(s string) string
- type ByteSize
- type ConfigBlock
Constants ¶
View Source
const ( FileModeROwner os.FileMode = 0600 FileModeRAll os.FileMode = 0644 )
View Source
const ( Base32 = "base32" Base64 = "base64" Hex = "hex" Base32Hex = Base32 + Hex Base32Std = Base32 + "std" Base64Std = Base64 + "std" Base64URL = Base64 + "url" )
View Source
const ( CommandRoot = "ops-cli" CommandCert = "cert" CommandConvert = "convert" CommandDig = "dig" CommandDiscord = "Discord" CommandDoc = "doc" CommandDos2Unix = "dos2unix" CommandEncode = "encode" CommandEncrypt = "encrypt" CommandGeoip = "geoip" CommandHash = "hash" CommandIcp = "icp" CommandLINE = "LINE" CommandOtp = "otp" CommandQrcode = "qrcode" CommandRandom = "random" CommandSlack = "Slack" CommandSSH = "ssh-keygen" CommandSystem = "system" CommandTelegram = "Telegram" CommandUpdate = "update" CommandURL = "url" CommandVersion = "version" CommandWhois = "whois" SubCommandAudio = "audio" SubCommandBootstrap = "bootstrap-token" SubCommandCalculate = "calculate" SubCommandExpand = "expand" SubCommandFile = "file" SubCommandGenerate = "generate" SubCommandGet = "get" SubCommandID = "id" SubCommandLowercase = "lowercase" SubCommandMan = "man" SubCommandMarkdown = "markdown" SubCommandNumber = "number" SubCommandPhoto = "photo" SubCommandRead = "read" SubCommandReST = "rest" SubCommandString = "string" SubCommandSymbol = "symbol" SubCommandText = "text" SubCommandUppercase = "uppercase" SubCommandVideo = "video" SubCommandVoice = "voice" SubCommandWiFi = "wifi" SubCommandYaml = "yaml" SubCommandYaml2JSON = "yaml2json" )
View Source
const ( HashMd5 = "md5" HashSha1 = "sha1" HashSha224 = "sha224" HashSha256 = "sha256" HashSha384 = "sha384" HashSha512 = "sha512" HashSha512_224 = "sha512_224" HashSha512_256 = "sha512_256" )
View Source
const ( IndentTwoSpaces = " " RepoOwner = "linzeyan" UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" )
Variables ¶
View Source
var ( ErrConfigContent = errors.New("config content is incorrect") ErrConfigTable = errors.New("table not found in the config") ErrFailedInitial = errors.New("initial failed") ErrIllegalPath = errors.New("illegal file path") ErrInvalidArg = errors.New("invalid argument") ErrInvalidFlag = errors.New("required flag(s) not set") ErrInvalidIP = errors.New("invalid IP") ErrInvalidFile = errors.New("invalid file format") ErrInvalidToken = errors.New("invalid token") ErrInvalidURL = errors.New("invalid URL") ErrResponse = errors.New("response error") ErrStatusCode = errors.New("status code is not 200") )
View Source
var ( Context = context.Background() TimeNow = time.Now().Local() )
Functions ¶
func Config ¶
func Config(path string, table ConfigBlock) map[string]any
Get secret token and other settings from config.
func GenerateQRCode ¶ added in v0.1.7
Generate QR code by giving content.
func HTTPRequestContent ¶
HttpRequestContent make a simple request to url, and return response body, default request method is get.
func HTTPRequestContentGB18030 ¶ added in v0.1.7
Same as HttpRequestContent, but read content in GB18030 format.
func HTTPRequestRedirectURL ¶ added in v0.1.7
Return redirect url.
func HashAlgorithm ¶
func ReadQRCode ¶ added in v0.1.7
Types ¶
type ConfigBlock ¶
type ConfigBlock string
Read config.toml.
const ( Discord ConfigBlock = "discord" Encrypt ConfigBlock = "encrypt" ICP ConfigBlock = "west" LINE ConfigBlock = "line" Slack ConfigBlock = "slack" Telegram ConfigBlock = "telegram" )
func (ConfigBlock) String ¶
func (c ConfigBlock) String() string
Click to show internal directories.
Click to hide internal directories.