GithubHelp home page GithubHelp logo

howdoi's Introduction

howdoi Build Status

Copy from howdoi:py, But Faster

Install

go get -v -u github.com/chinanf-boy/howdoi

of cos, releases

Uasge

same as py:howdoi , but lit diff

$ howdoi -q "format date bash" -c -C

demo

TODO

  • base Feature, Get the data
  • Proxy can with Socks5
  • how many answers you want -n
  • go func with questions
  • colorful Code text with shell env -c/-T, chroma
  • cache Result -C useful refs
  • ReCache Result -R, just use GET, you still use -C if want to Cache Result
  • go func with ALL engines
  • add ChanHowdoi: got one result, show it, rather than all results
  • test file
  • Issue me anything

Notes: , cli-name Over the Python version cli

Tips

About the ENV

ENV Desc Default
HOWDOI_DISABLE_SSL change https:// => http:// nil
HOWDOI_URL search engine with the ask website stackoverflow.com
HOWDOI_URL_REGEX match the regex with URL questions/\d+/
HOWDOI_SEARCH_ENGINE search engine{bing|google} ALL
HOWDOI_CACHE_DIR http Response - Cached dir $HOME/.howdoi-cache
-T chroma theme pygments

HOWDOI_SEARCH_ENGINE, default ALL, mean GET ALL engines, but got the winner about speed.

NOTE, careful about Cache dir, you will miss the ever Data after you changed diff HOWDOI_CACHE_DIR。

Ref

chroma theme

themes >>
[
  abap, algol, algol_nu, arduino, autumn, borland, bw, colorful, dracula, emacs, friendly, fruity, github, igor, lovelace, manni, monokai, monokailight, murphy, native, paraiso-dark, paraiso-light, pastie, perldoc, pygments, rainbow_dash, rrt, solarized-dark, solarized-dark256, solarized-light, swapoff, tango, trac, vim, vsxcode
]

Cli

usage: howdoi [-h|--help] [-c|--color] [-v|--version] [-n|--num <integer>]
              -q|--query "<value>" [-q|--query "<value>" ...] [-D|--debug]
              [-T|--theme "<value>"] [-C|--cache] [-R|--recache]

              cli to Ask the question

Arguments:

  -h  --help     Print help information
  -c  --color    colorful Output. Default: false
  -v  --version  version
  -n  --num      how many answer. Default: 1
  -q  --query    query what
  -D  --debug    debug *
  -T  --theme    chrome styles. Default: pygments
  -C  --cache    cache response?. Default: false
  -R  --recache  reGET response, Cache thing have to with -C ?. Default: false

Why rewrite

  1. proxy,some issue with socks
  2. fast

howdoi's People

Contributors

chinanf-boy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

khaos-labs

howdoi's Issues

Socks5 ❌: 503 Service Unavailable

  1. After success, search google with "format date bash" many times

Bug show

2018/10/30 19:04:35 status code error: https://www.google.com/sorry/index? \ 
continue=https://www.google.com/search%3Fq%3Dformat%2Bdate%2Bbash%2Bsite%253Astacko\
erflow.com&q=EgQ2UFdTGML14N4FIhkA8aeDS6PRmokmZyrZzdzupPdTikEvF1YEMgFy \ 
503 Service Unavailable
exit status 1

Some query, the 'bing' engine, get me the empty box

Command

$ howdoi -q "go build args ldflags" -c -C -n 2 -D

Debug output

02:23:05.548 17us   15us   getChanInstructions - starting
02:23:05.548 2us    2us    getResult - 0. get URL
02:23:05.548 2us    2us    getResult - 0. get URL
02:23:05.550 1ms    1ms    getResult - ReCache:false
02:23:05.550 3us    3us    getResult - 0.2 Resq from GET URL https://www.google.com/search?q=go+build+args+ldflags+site%3Astackoverflow.com
02:23:05.550 14us   14us   getResult - 0.3 Fake UA Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
02:23:05.550 2ms    2ms    getResult - 0.1 Resq from Cache https://www.bing.com/search?q=go+build+args+ldflags+site%3Astackoverflow.com
02:23:05.552 789us  788us  extractLinks - bing, extract link 0

extract link 0

Google page safe: then we can not search the Element 🔎

google page GET like that

<a class="C8nzq BmP5tf" href="https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script&amp;ved=2ahUKEwjuzsbR0K_eAhUJuVkKHUy1CY4QFjAAegQIBRAB"><div aria-level="3" role="heading" class="MUxGbd v0nnCb">bash - YYYY-MM-DD format date in shell script - Stack Overflow</div><div class="zbELhe MUxGbd lyLwlc aLF0Z"><span class="qzEoUe">Stack Overflow › questions › yyyy-mm-...</span></div></a>

class="***", we can not use Find(".*"), Fix is change => Find("a")

and check that a element's href make isQuestion true

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.