Coder Social home page Coder Social logo

fragolinux / trurl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from curl/trurl

0.0 0.0 0.0 162 KB

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

Home Page: https://curl.se/trurl/

License: Other

Perl 38.50% C 40.70% Makefile 0.92% Roff 10.94% Python 8.94%

trurl's Introduction

trurl

command line tool for URL parsing and manipulation

video presentation

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%[email protected]/hello#frag",
      "scheme": "https",
      "user": "::moo::",
      "host": "fake.host",
      "port": "443",
      "path": "/hello",
      "fragment": "frag"
    }
  ]

  $ trurl "https://example.com?search=hello&utm_source=tracker" --trim query="utm_*"
  https://example.com/?search=hello

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

On Windows:

  1. Download and run Cygwin installer.
  2. Follow the instructions provided by the installer. When prompted to select packages, make sure to choose the following: curl, libcurl-devel, libcurl4, make and gcc-core.
  3. (optional) Add the Cygwin bin directory to your system PATH variable.
  4. Use make, just like on Linux.

Prerequisites

Development files of libcurl (e.g. libcurl4-openssl-dev or libcurl4-gnutls-dev) are needed for compilation. Requires libcurl version 7.62.0 or newer (the first libcurl to ship the URL parsing API).

trurl also uses CURLUPART_ZONEID added in libcurl 7.81.0 and curl_url_strerror() added in libcurl 7.80.0

It would certainly be possible to make trurl work with older libcurl versions if someone wanted to.

Older libcurls

trurl builds with libcurl older than 7.81.0 but will then not work as good. For all the documented goodness, use a more modern libcurl.

trurl's People

Contributors

bagder avatar emanuele6 avatar krishean avatar zhongruoyu avatar dfandrich avatar jacobmealey avatar abbbi avatar jlecour avatar fragolinux avatar havbon avatar xfgusta avatar lu-zero avatar marianposaceanu avatar mnhauke avatar nekobbbbbbit avatar oalders avatar ryru avatar sfmqrb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.