Quickstart¶
This page will guide you through setting up cQuery and running your first query. If you experience any problems here or are looking for more information about each step, head on the the Tutorial for a full overview or Example to experience a demo project.
Install¶
$ pip install cquery
Note
cQuery is a pure-Python library and as such will require an installation of Python.
Note
cQuery has been tested on Python 2.7.7 on Windows 8.1 and Ubuntu 13.01
Some Content¶
$ cd c:/projects
$ mkdir spiderman/assets/Peter
$ mkdir spiderman/assets/Goblin
$ mkdir spiderman/shots/1000
$ mkdir spiderman/shots/2000
Tag¶
Note
cQuery ships with an executable. On Windows, you may have to add the Python27\scripts directory to your PATH.
$ cd spiderman/assets
$ cquery tag .Asset --root=Peter
$ cquery tag .Asset --root=Goblin
$ cd ../shots
$ cquery tag .Shot --root=1000
$ cquery tag .Shot --root=2000
Query¶
$ cd ..
$ cd ..
$ cquery search .Asset
c:/projects/spiderman/assets/Peter
c:/projects/spiderman/assets/Goblin
And that’s it. Now you can tag and query via the command-line.
Python¶
From Python, you could query like this:
import os
import cquery
for match in cquery.matches(os.getcwd(), selector='.Asset'):
print match
Next we’ll have a look at a more thorough version of this quickstart.