Skip to content
/ trurl Public
forked from curl/trurl

trurl is a command line tool for URL parsing and manipulation.

License

Notifications You must be signed in to change notification settings

lu-zero/trurl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trurl

command line tool for URL parsing and manipulation

original idea

Example command lines

  $ trurl --url https://curl.se --set host=example.com
  https://example.com/

  $ trurl --set host=example.com --set scheme=ftp
  ftp://example.com/

  $ trurl --url https://curl.se/we/are.html --redirect here.html
  https://curl.se/we/here.html

  $ trurl --url https://curl.se/we/../are.html --set port=8080
  https://curl.se:8080/are.html

  $ trurl --url https://curl.se/we/are.html --get '{path}'
  /we/are.html

  $ trurl --url https://curl.se/we/are.html --get '{port}'
  443

  $ trurl https://example.com/hello.html --get '{scheme} {port} {path}'
  https 443 /hello.html

  $ trurl --url https://curl.se/hello --append path=you
  https://curl.se/hello/you

  $ trurl --url "https://curl.se?name=hello" --append query=search=string
  https://curl.se/?name=hello&search=string

  $ trurl --url-file url-list.txt --get '{host}'
  [one host name per URL in the input file]

  $ cat url-list.txt | trurl --url-file - --get '{host}'
  [one host name per URL in the input file]

  $ trurl "https://fake.host/hello#frag" --set user=::moo:: --json
  [
    {
      "url": "https://%3a%3amoo%3a%3a@fake.host/hello#frag",
      "scheme": "https",
      "user": "::moo::",
      "host": "fake.host",
      "port": "443",
      "path": "/hello",
      "fragment": "frag"
    }
  ]

Install

On Linux :

It's quite easy to compile the C source with GCC :

$ make
cc  -W -Wall -pedantic -g   -c -o trurl.o trurl.c
cc   trurl.o  -lcurl -o trurl

Note that development files of libcurl (e.g. libcurl4-openssl-dev or libcurl4-gnutls-dev) are needed for compilation. Requries libcurl version 7.62.0 or newer.

About

trurl is a command line tool for URL parsing and manipulation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 69.3%
  • Roff 17.2%
  • Perl 11.7%
  • Makefile 1.8%