github.com/TaceyWong/ctools@v0.1.1-0.20201221084458-4d7a8190b2ac/README.md (about)

     1  # ctools
     2  
     3  [![Go Report Card](https://goreportcard.com/badge/github.com/TaceyWong/ctools)](https://goreportcard.com/report/github.com/TaceyWong/ctools)
     4  
     5  Coder👨‍💻 Tools🛠
     6  
     7  **Now:Just a Test Repo**
     8  
     9  
    10  ## Desc
    11  
    12  run :
    13  ```shell
    14  $ctools
    15  ```
    16  
    17  output:
    18  
    19  ```text
    20  
    21    .,-:::::::::::::::::   ...         ...      :::     .::::::.
    22    ,;;;'''';;;;;;;;''''.;;;;;;;.   .;;;;;;;.   ;;;    ;;;'    '
    23  [[[            [[    ,[[     \[[,,[[     \[[, [[[    '[==/[[[[,
    24  $$$            $$    $$$,     $$$$$$,     $$$ $$'      '''    $
    25  '88bo,__,o,    88,   "888,_ _,88P"888,_ _,88Po88oo,.__88b    dP
    26    "YUMMMMMP"   MMM     "YMMMMMP"   "YMMMMMP" """"YUMMM "YMmMY"
    27  
    28  Please type `ctools -h/--help` for the help of usage
    29  ```
    30  run `ctools -h`:
    31  
    32  output:
    33  ```text
    34  NAME:
    35     ctools - Coder Toolbox,Programmer General Tools
    36  
    37  USAGE:
    38     ctools [global options] command [command options] [arguments...]
    39  
    40  VERSION:
    41     0.0.1dev
    42  
    43  AUTHORS:
    44     Tacey Wong <xinyong.wang@qq.com>
    45     All Contributors
    46  
    47  COMMANDS:
    48     httpcode, hc  search http code info
    49     imail, im     send email
    50     request, rq   send http request,more friendly
    51     shortme, hp   url -> short url
    52     help, h       Shows a list of commands or help for one command
    53  
    54     Code Minifiers / Beautifier:
    55       css_beauty, css_p             Formats your CSS files for optimal readability.
    56       css_mini, css_m               Compresses a CSS string/file with no possible side-effect
    57       javascript_beauty, js_beauty  Formats your JS files for optimal readability
    58       javascript_mini, js_mini      Compresses a JavaScript string/file with no possible side-effect
    59  
    60     Converters:
    61       csv2json, c2j        convert a CSV file into an JSON file
    62       csv2xml, c2x         convert a CSV file into an XML file
    63       curl2go, curl2g       turns a curl command into Go code.
    64       json2go, c2g         convert a JSON file into an go struct file
    65       json2xml, c2x        convert a JSON file into an xml file
    66       timestamp2date, t2d  Converts an epoch/unix timestamp into a human readable date
    67       url2bt, c2x          convert a url-str into bt-str(xunlei-kuaiche-xuanfeng)
    68       xml2json, x2j        convert a XML file into an JSON file
    69       xml2xsd, x2x         Generates a XSD (XML Schema) from a XML file.
    70       xml2xsl, x2xsl       Transform an XML file using an XSL (EXtensible Stylesheet Language) file.
    71  
    72     Cryptography & Security:
    73       digester, digest      Computes a digest from a string using different algorithms.
    74       hmac_gen, hmac_g      Computes a Hash-based message authentication code (HMAC) using different algorithms.
    75       htpasswd, hp          gen httpassword
    76       md5_gen, md5_g        Computes a digest from a string using MD5
    77       sha256_gen, sha256_g  Computes a digest from a string using SHA-256.
    78       sha512_gen, sha512_g  Computes a digest from a string using SHA-512.
    79  
    80     Dev-Tool:
    81       asciiflow, af  tool of drawing ascii flow.
    82  
    83     Encoders & Decoders:
    84       base64, bs64            Encodes or decodes a string so that it conforms to the Base64 Data Encodings specification (RFC 4648).
    85       qrcode, qr              Generate QR Codes & Decode QR-Pic
    86       url_encode_decode, ued  Encodes or decodes a string so that it conforms to the the Uniform Resource Locators Specification - URL (RFC 1738).
    87  
    88     Formatters:
    89       html_format, hf                  Format HTML Text
    90       json_format, jf                  Format JSON Text
    91       nginx_conf_format, nginx_conf_f  Format HTML Text
    92       sql_format, sf                   Format SQL Text
    93       xml_format, hf                   Format XML Text
    94  
    95     Fun:
    96       consolepic, console_p  show a picture in console
    97  
    98     String Escaper & Utilities:
    99       csv_escape, ce           Escapes or unescapes a CSV string removing traces of offending characters that could prevent parsing.
   100       html_escape, he          Escapes or unescapes an HTML file removing traces of offending characters that could be wrongfully interpreted as markup.
   101       java_dotnet_escape, jde  Escapes or unescapes a Java or .Net string removing traces of offending characters that could prevent compiling.
   102       json_escape, jsone       Escapes or unescapes a JSON string removing traces of offending characters that could prevent parsing.
   103       sql_escape, sqle         Escapes or unescapes a SQL string removing traces of offending characters that could prevent execution.
   104       str_util, su             A couple of online string utilities written in JavaScript.
   105       xml_escape, xe           Escapes or unescapes an XML file removing traces of offending characters that could be wrongfully interpreted as markup.
   106  
   107     Validators:
   108       cron_gen, cg    Generate a quartz cron expression with an easy to use interface
   109       html_valid, hv  Validates the HTML string/file for well-formedness and compliance with w3c standards
   110       json_valid, jv  Validates a JSON string against RFC 4627
   111       regex_test, rt  Highlight every match in the original string so that you know exactly where a match occurs.
   112       xml_valid, xv   Validates the XML string/file against the specified XSD string/file
   113       xpath_test, xt  Executes an XPath query against an XML file
   114  
   115     Web Resources:
   116       canada_province, cprovince   snippets to generate a list of provinces and territories for Canada
   117       china_province, chinap       snippets to generate a list of provinces and territories for China
   118       html_entities, hentity      Complete list of HTML entities with their numbers and names
   119       i18n, i18                    list of formatting standards for dates, time, decimals, currencies and more with code snippets
   120       iso_country_list, icl        snippets to generate a list of countries using the ISO-3166-1 and ISO-3166-2 codes.
   121       less_compiler, less_c       Compiles a LESS file into a CSS file. Full support for all LESS features except @import.
   122       lorem_lpsum_generator, llg  choose how many sentences, paragraphs or list items you want.
   123       mexico_state, mexcio_s      snippets to generate a list state for Canada
   124       mime_type_list, mtl         Full list of MIME types
   125       sass_compiler, sass_c       Compiles a SASS file into a CSS file. Full support for all LESS features except @import.
   126       timezone_list, timezone_l   snippets to generate a list of time zones
   127       url_parser, url_p            parses a URL into its individual components (protocol, scheme, userinfo, host, port, authority, path, resource, etc.)
   128       usa_state, mexcio_s         Snippets to generate a list of states for the United States
   129  
   130  GLOBAL OPTIONS:
   131     --config FILE, -c FILE  load configuration from FILE
   132     --lang value, -l value  language for the app (default: "english") [$CTOOLS_LANG]
   133     --help, -h              show help
   134     --version, -v           print the version
   135  
   136  COPYRIGHT:
   137     © 2018 - Forever Tacey Wong and Contributors
   138  ```
   139  
   140  
   141  
   142  
   143  ## Contribute
   144  
   145  **ctools** uses these following third-party toolkits mainly:
   146  
   147  + [cli](https://github.com/urfave/cli/v2) for parsing commandline args
   148  + [viper](https://github.com/spf13/viper) for loading configuration
   149  + [gocui](https://github.com/jroimartin/gocui) for Console UI (some tools maybe use it)
   150  + [go-prompt](https://github.com/c-bata/go-prompt) for interactive prompts
   151  + [survey](https://github.com/AlecAivazis/survey) for interactive prompts
   152  
   153  
   154  code template:
   155  
   156  ```golang
   157  package tools
   158  
   159  /*
   160  description of tool
   161  */
   162  
   163  import (
   164      "github.com/urfave/cli/v2"
   165      //what import
   166  )
   167  
   168  #ToolCMD desc
   169  var ToolCMD = cli.Command{
   170  	Name:    "tool-name",
   171  	Aliases: []string{"tool-name-alias"},
   172  	Usage:   "the function of tool",
   173  	Flags: []cli.Flag{
   174  		cli.StringFlag{
   175  			Name:  "config, c",
   176  			Usage: "Load configuration from `FILE`",
   177          },
   178          //flag
   179  	},
   180  	Action: Tool,//main function of tool
   181  }
   182  
   183  # Tool desc
   184  func Tool (c *cli.Context) error {
   185  		return nil
   186  	}
   187  ```
   188  place it into `ctools/tools/` and append the `ToolCMD`  to `app.Commands` in `ctools.go` like following:
   189  
   190  ```golang
   191  app.Commands = append(app.Commands, tools.ToolCMD)
   192  ```