Skip to content

Commit

Permalink
📘 Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Dec 13, 2020
1 parent 0ed2dd0 commit fd076a8
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**u**_**(rl)**_**new** — A tool for append URLs, skipping duplicates & combine parameters. Inspired by [anew](https://github.com/tomnomnom/anew) & [qsreplace](https://github.com/tomnomnom/qsreplace).

# Usage
## Usage

```bash
▶ cat urls.txt | unew
Expand All @@ -12,38 +12,44 @@
▶ unew urls.txt output.txt
```

## Flags
### Flags

Usage of `unew`:
```
-combine
Combine parameters
Combine parameters
-r string
Replace parameters value
Replace parameters value
-skip-path value
Skip specific paths (regExp pattern)
```

# Install
## Install

with [Go](https://golang.org/doc/install):

```bash
▶ go get -u github.com/dwisiswant0/unew
```

# Workaround
## Workaround

If you have a list as
If you have a `urls.txt` list as

```txt
https://twitter.com/dwisiswant0?href=evilzone.org
https://twitter.com/dwisiswant0
https://twitter.com/dwisiswant0?ref=github&utm_source=github
https://twitter.com/dwisiswant0/status/1305022512590278656
https://www.linkedin.com/in/dwisiswanto/
https://www.linkedin.com/in/dwisiswanto/?originalSubdomain=id
https://www.linkedin.com/in/dwisiswanto/?originalSubdomain=id&utm_medium=github
```

Sample workaround
### Regular

Sample workarounds:

```bash
▶ cat urls.txt | unew
https://twitter.com/dwisiswant0?href=evilzone.org
Expand All @@ -52,6 +58,8 @@ https://www.linkedin.com/in/dwisiswanto/

If the list contains multiple URLs with same path, it will save the first one and its parameters.

### Combining parameters

But you can combine parameters if the same path exists by using `-combine` flag.

```bash
Expand All @@ -60,10 +68,21 @@ https://twitter.com/dwisiswant0?href=evilzone.org&ref=github&utm_source=github
https://www.linkedin.com/in/dwisiswanto/?originalSubdomain=id&utm_medium=github
```

### Query replacers

Use the `-r` flag if you want to change the value of all parameters.

```bash
▶ cat urls.txt | unew -combine -r "/etc/passwd"
https://twitter.com/dwisiswant0?href=%2Fetc%2Fpasswd&ref=%2Fetc%2Fpasswd&utm_source=%2Fetc%2Fpasswd
https://www.linkedin.com/in/dwisiswanto/?originalSubdomain=%2Fetc%2Fpasswd&utm_medium=%2Fetc%2Fpasswd
```

### Skipping paths

In case if you want to pass specific/multiple URL paths, you can use `-skip-path` flag for it _(can be set multiple times)_. But, you have to write it with regExp pattern.

```bash
▶ cat urls.txt | unew -skip-path "^/[\w]+/status/[0-9]+" -skip-path "/in/[\w]+"
https://twitter.com/dwisiswant0?href=evilzone.org
```

0 comments on commit fd076a8

Please sign in to comment.