Awesome program howdoi which implemented in rust
hors is written in Rust
. The recommended way to install hors
is through cargo
.
shell
cargo install hors
```shell
USAGE:
hors [FLAGS] [OPTIONS]
FLAGS: -a, --all display the full text of the answer. -h, --help Prints help information -l, --link display only the answer link. -v, --version displays the current version of howdoi
OPTIONS:
-n, --number_answers
ARGS:
shell
hors "pandas dataframe to csv"
Here it is:
- Answer from https://stackoverflow.com/questions/16923281/pandas-writing-dataframe-to-csv-file
df.to_csv(file_name, sep='\t')
shell
hors "pandas dataframe to csv" -l
Here it is:
Title - pandas writing dataframe to csv file
https://stackoverflow.com/questions/16923281/pandas-writing-dataframe-to-csv-file
shell
hors "how to parse json in rust" -a
Here it is: ```shell - Answer from https://stackoverflow.com/questions/30292752/how-do-i-parse-a-json-file
Solved by the many helpful members of the Rust community:
extern crate rustcserialize; use rustcserialize::json::Json; use std::fs::File; use std::io::Read;
fn main() { let mut file = File::open("text.json").unwrap(); let mut data = String::new(); file.readtostring(&mut data).unwrap();
let json = Json::from_str(&data).unwrap();
println!("{}", json.find_path(&["Address", "Street"]).unwrap());
} ```
What if we want to make output code colorized?
shell
hors "how to parse json in python" -c
Here it is:
python
import json
j = json.loads('{"one" : "1", "two" : "2", "three" : "3"}')
print j['two']
How to get more than one answers
shell
hors "set git remote url" -n 2 -a
Here it is:
```
git remote set-url origin new.git.url/here
(see git help remote) or you can just edit .git/config and change the URLs there. You're not in any danger of losing history unless you do something very silly (and if you're worried, just make a copy of your repo, since your repo is your history.)
^^ ==================================================== ^^
git remote add origin git@github.com:User/UserRepo.git
below is used to change the url of an existing remote repository:
git remote set-url origin git@github.com:User/UserRepo.git
below will push your code to the master branch of the remote repository defined with origin and -u let you point your current local branch to the remote master branch:
git push -u origin master
Documentation ```
Very thanks for these awesome project :)
- howdoi which inspired hors
(Fow now hors
is howdoi
which implements in rust
).
- reqwest provides powerful http request api.
- syntect provides syntax highlighting feature.
- rand provides random choice generation.
- clap provides command line argument parser.
- stackoverflow helps user solve question about coding.
hors
is the abbreviation of howdoi in rust
.