https://github.com/ymc-github/sh-lib-url-parse
like nodejs lib 'url'
https://github.com/ymc-github/sh-lib-url-parse
lib parse shell url
Last synced: 10 months ago
JSON representation
like nodejs lib 'url'
- Host: GitHub
- URL: https://github.com/ymc-github/sh-lib-url-parse
- Owner: YMC-GitHub
- License: mit
- Created: 2020-02-14T18:40:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-14T18:41:01.000Z (over 6 years ago)
- Last Synced: 2025-02-25T09:23:31.631Z (over 1 year ago)
- Topics: lib, parse, shell, url
- Language: Shell
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sh lib url parse
## desc
like nodejs lib 'url'
## feat
- support protocol
- support host
- support port
- support pathname
- support search
## how to use for poduction?
```sh
# get the code
# run the index file
# ./index.sh
# or import to your sh file
# source /path/to/the/index file
# usage
url="http://videomy.xx.com:8091/20200126/IPX-xx/index.m3u8"
url_protocol "$url" #it will return "http"
url_host "$url" #it will return "videomy.xx.com"
url_port "$url" #it will return "8091"
url_port ":90" #it will return "90"
url_port "xx.com/xx/xx" #it will return "80"
url_pathname "$url" #it will return "/20200126/IPX-xx/index.m3u8"
url="xx/xx/xx/?appid=aaaa&apidx=0"
url_search "$url" #it will return "?appid=aaaa&apidx=0"
query="appid=aaaa&apidx=0"
parse_url_query $query "appid" #it will return "aaaa"
```
## how to use for developer?
```sh
# get the code
# run test
./test.sh
#2 get some fail test
./test.sh | grep "it is false"
```
## author
yemiancheng
## license
MIT