printev

package module
v0.0.0-...-ba6d4bf Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 8 Imported by: 0

README

GoDoc Build Status codecov Go Report Card

printev

Features

  • Read env var from go and ruby codes
  • Output served on the sorted format
NAME:
   printev - Generate env variable from given codes

USAGE:
   main [global options] command [command options] [arguments...]

VERSION:
   1.0.1

DESCRIPTION:
   Go Env Printer

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --source value, -s value  [Optional] Target source code. (default: current dir)
   --mute, -m                [Optional] Hide preview and log. (default: false)
   --write, -w               [Optional] Write environment variables found. (default: false)
   --output value, -o value  [Optional] Output location of generated env files, by default write to printev.sample (default: "printev.sample")
   --help, -h                show help (default: false)
   --version, -v             print the version (default: false)

COPYRIGHT:
   Lumochift™ © 2020

Installation

go get -u github.com/lumochift/printev/cmd/printev

Sample run

Source code example
package main

import (
    "fmt"
    "os"
)

func main() {
    fmt.Println(os.Getenv("TEST_ENV_1"))
    fmt.Println(os.Getenv("TEST_ENV_2"))
}
Output
➜   printev -s testdata
List env variable:
TEST_ENV_1
TEST_ENV_2

Documentation

Overview

Package printev provides functionality to get all env usage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindEnv

func FindEnv(path string) []string

FindEnv from path, currently get env from *.go files

func GetEnv

func GetEnv(b []byte, lang Lang) (records []string)

GetEnv from given []bytes value

func GetEnvStruct

func GetEnvStruct(b []byte) (records []string)

GetEnvStruct fetch env from tag struct

Types

type Lang

type Lang byte

Lang is type holder for programming language type

const (
	// Go programming language
	Go Lang = iota
	// Ruby programming language
	Ruby
	// Node Lang
	Node
)

Directories

Path Synopsis
cmd
printev command

Jump to

Keyboard shortcuts

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