Command line interface
The adaparse command tool takes URL strings (ASCII/UTF-8) and it validates, normalizes and queries them efficiently.
Options
-d
,--diagram
: Print a diagram of the result-u
,--url
: URL Parameter (required)-h
,--help
: Print usage-g
,--get
: Get a specific part of the URL (e.g., ‘origin’, ‘host’, etc. as mentioned in the examples above)-b
,--benchmark
: Run benchmark for piped file functions-p
,--path
: Process all the URLs in a given file-o
,--output
: Output the results of the parsing to a file
Usage/Examples
Well-formatted URL
Output:
Diagram
Output:
Pipe Operator
Ada can process URLs from piped input, making it easy to integrate with other command-line tools
that produce ASCII or UTF-8 outputs. Here’s an example of how to pipe the output of another command into Ada.
Given a list of URLs, one by line, we may query the normalized URL string (href
) and detect any malformed URL:
Output:
Our tool supports the passing of arguments to each URL in said file so that you can query for the hash, the host, the protocol, the port, the origin, the search, the password, the username, the pathname or the hostname:
Output:
If you omit -g
, it will only provide a list of invalid URLs. This might be
useful if you want to valid quickly a list of URLs.
Benchmark Runner
The benchmark flag can be used to output the time it takes to process piped input:
Output:
Saving result to file system
There is an option to output to a file on disk:
As well as read in from a file on disk without going through cat:
Advanced Usage
You may also combine different flags together. E.g. Say one wishes to extract only the host from URLs stored in wikipedia.txt and output it to the test_write.txt file:
Output:
Content of test_write.txt: