1.1.92 • Published 8 years ago

querydom v1.1.92

Weekly downloads
1
License
ISC
Repository
github
Last release
8 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

8 years ago

1.1.91

8 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago