1.1.92 • Published 7 years ago

querydom v1.1.92

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

querydom Build Status

jQuery style DOM querying from the command line, for easy querying & piping i/o to other command line utilities.

Installation

$ npm install -g querydom

Usage

querydom uses querySelector syntax, or what you're used to from CSS or jQuery.

You can easily pipe HTML to the querydom command:

$ curl -s http://www.google.com | querydom title
> "Google Search"

$ echo '<div class="example">Hello, World!</div>' | querydom 'div.example'
> "Hello, World!" 

You can also pass an HTML string as the first argument:

$ querydom '<textarea>Success</textarea>' textarea
> "Success"

Operations

You can supply jQuery-like operations, and the program will output the result. The default operation if none is supplied is --text, so the program by default behaves like jQuery(selector).text()

Equivalent to $('input').attr('name'):

$ echo '<input name="user" value="john">' | querydom input --attr=name
> "user"

Equivalent to $('input').val:

$ echo '<input name="user" value="john">' | querydom 'input' --val
> "john"

Chaining

Chaining works as well. Below is the equivalent to $('span').parent().find('span').text():

$ echo '<div><span>foobar</span></div>' | querydom span --parent --find=span --text
> "foobar"
1.1.92

7 years ago

1.1.91

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago