Skip to content

Commit

Permalink
CLI utility to execute queries remotely
Browse files Browse the repository at this point in the history
  • Loading branch information
videlalvaro committed Oct 10, 2011
1 parent 8127df6 commit e306dd1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/wolfskin/cli.clj
@@ -0,0 +1,23 @@
(ns wolfskin.cli
(:require [clojure.pprint :as pprint]
[clojure.contrib.command-line :as ccl]
[wolfskin.utils :as utils]
))

(defn -main [& args]
(ccl/with-command-line args
"Command line demo"
[[url "Repository URL" "http://localhost:8080/rmi"]
[username u "User Name" "admin"]
[password p "User password", "admin"]
[workspace w "JCR Workspace"]
[sql? "Sets query as JCR_SQL2" true]
[xpath? "Sets query as XPATH"]
[query q "Query to execute"]]
(let [qtype (if sql? :sql :xpath)
nodes (utils/run-query url username password workspace qtype query)
]
(pprint/pprint (utils/node-properties nodes)))))



0 comments on commit e306dd1

Please sign in to comment.