easy_arg 0.2.1

EasyArg read variables from command line arguments/system envrioment/.env files
Documentation
# EasyArg

EasyArg parse args from command line arguments/system envrioment/.env files

### You will read:
- how to set
- how to get
- how to alias
- how to add help description

## How to set
 
### 1.Command line:
```bash
your_app -p --name=some_one -- invalid --hello "world"
```
will produce:

```
{
    "name": "some_one",
    "hello": "world",
    "p": "true",
}
```

rule:
```
--p = "abc" ✔
--p=abc     ✔
--p abc     ✔
--p -- abc  ✔ // p = "abc",-- will be ignored
-p          ✔ // p = "true"
-p=abc      ✔
--p         ❌
```


### 2.system envrironment variable
```bash
export SOME_VAR=123
```

Then you can access it by:

```
let easy = EasyArg::new();
easy.get_string("SOME_VAR") // "123"
```

### 3..env files
You can use .env file in diffrent ways:

- pass `-e`/`--envfile`/`-envfile` args

If no envfile args, it will search (in order):

1. current_working_directory/.env
2. current_working_directory/.easy_arg.env
3. home_directory/.easy_arg.env

#### If you want to customize the .env filename, use 

```
EasyArg::new_with_env("your_file_name");
```

It will search:
- current_working_directory/your_file_name.env
- home_directory/your_file_name.env

.env example

```
DIR = abc
DIR2="dfdadfasfasf" # this is a comment
 GOOD
# THIS IS A COMMENT LINE
     =
HHD = ${HOME}/abc/${NOT_EXIST}
OK=
```

will produce

```
{
    "OK": "true",
    "DIR": "abc",
    "DIR2": "dfdadfasfasf",
    "HHD": "/home/xxx/abc/${NOT_EXIST}",
    "GOOD": "true",
}
```


## How to get

Note: All variables will be parsed to string.

`easy` represents an instance of `EasyArg`.

### 1. You need the raw string
```
easy.raw_value("KEY");
```

### 2. You need a string, event it doesn't exist
```
easy.get_string("KEY");
```

### 3. panic if the string doesn't exist
```
easy.must_get_string("IMPORTANT_KEY");
```

### 4. You need bool value
if you didn't provid a value for the key, it defaults to true.
Only `"false"`,`"False"`,`"FALSE"`,`"0"`,`"null"`,`"NULL"`,`"Null"` will be parsed to false.
```
easy.get_bool("KEY");
```

### 5. You need a vec
```
// --list=a,b,c
easy.get_vec("KEY") // the result: vec!["a", "b", "c"]
```

## How to alias
```
your_app -p --s=xbox
```
your rust code

```
easy.alias("p", "PS5")

easy.to_string("PS5") // "true"
easy.to_string("p") // "true"
```

## How to add help description

```
easy.desc_str("a", "description")
easy.desc_flag("b", "description")
```

output:
```
Executable: target/debug/xxx
-- a           description
- b           description
```

## TODO:
- [ ] write tests
- [ ] add section readme