Home

Awesome

auxilio


I'll be honest and I'll say that I'm a bit lazy sometimes. I'm one of those developers which don't like to repeat same actions again and again. There are dozen of things which I have to do while working on a project. Very often I'm covering the development of several applications and have to switch between them. It's really annoying process. I hate to have many opened tabs in my browser, many consoles or several code editors. I always try to improve my productivity by automating tasks. I think that even switching between opened applications takes too much time.

Auxilio is an extension for Google Chrome which helps me to solve some of the above problems. During the development I realize that it's much more then a tool for workflow optimization. Here is what I'm using it for:

Before to give you more details about every of the items above, let me clarify how everything works. Auxilio has two parts. The first one is of course an extension of my favorite browser and the second one is a nodejs application, which I called auxilio-backend. The extension uses web sockets (socket.io) and connects to the node app. You can do a lot of stuff inside your browser. However, there are some tasks which are not permitted. For example you can't watch file for changes or execute shell commands. For these things I decided to use node, because:

If I need to do something inside the browser I'm using the Google's APIs, while the back-end is taking care about the OS related stuff. The extension just sends commands and gets response.

Auxilio

Installation

Auxilio back-end

First of all install NodeJS. It's pretty easy. Just go to nodejs.org and click the big green button. The back-end is distributed as node package, so you can easily install it via the node package manager.

npm install -g auxilio-backend

Once everything completes simply run it via

auxilio-backend

You should see

info  - socket.io started
Auxilio back-end started.

Auxilio Chrome extension

There are two ways to use an extension for Chrome.

Usage

New tab page

When you open a new tab Chrome usually shows most visited pages. There are some other things like recent closed pages or installed apps, but actually I didn't use them very often. That's why I decided to customize that part of the browser. The new page shows the current date and time, good quotes made by smart developers and of course a button which points to the old page if needed.

Auxilio

DevTools tab

DevTools is a great instrument for programmers. Luckily there is an API which we can use to add new tabs. It is also good that you can open the panel with shortcuts like Ctrl + J or Ctrl + I. However, there is no way to associate a shortcut to your custom tab. So, what I'm doing is to open DevTools and use Ctrl + [ or Ctrl + ] to navigation between the tools.

Auxilio

In Google Chrome web store

Auxilio

Installing the extension

Follow the link above and click the green button Add to Chrome or check the steps below

Installing the node module

npm install -g auxilio-backend

Resources

An in-depth article about the extension - link

Documentation

common

clear

Clearing the current console's output.

Examples:

<pre>clear</pre>

In script

<pre>clear()</pre>

compare

Compares values. (Have in mind that it works only with strings and numbers.)

Examples:

Command line

<pre>compare "Check those values" 10 == 20</pre>

Command line (chaining)

<pre>date true &amp;&amp; read monthName &amp;&amp; compare "Is it July?" July ==</pre>

In script

<pre>compare('"My title here"', 10, "==", 10, function(res) { console.log(res); })</pre>

date

Gets the current date.

Examples:

Command line

<pre>date</pre>

Command line (chaining)

<pre>date true &amp;&amp; read monthName &amp;&amp; info</pre>

In script

<pre>date("true", function(date) { console.log(date.year); })</pre>

delay

Delays the next command

Examples:

Command line

<pre>delay 2000</pre>

Command line (chaining)

<pre>echo A &amp;&amp; delay 2000 &amp;&amp; echo B</pre>

In script

<pre>delay(2000, function() { console.log("hello"); })</pre>

diff

Comparison of files (text and json) or strings.

Examples:

Opens a browse window for picking two files

<pre>diff</pre>

Comparing two strings

<pre>diff "Hello world!" "Hello world, dude!"</pre>

Command line (chaining)

<pre>date true &amp;&amp; read monthName &amp;&amp; diff "Current month is July"</pre>

In script

<pre>diff('"Hello world!"', '"Hello world dude!"', function(res) { console.log(res); })</pre>

exec

Executes a given command. Accepts commands separated by <i>&&</i>.

Examples:

Command line

<pre>exec echo "test"</pre>

Command line (chaining)

<pre>readfile showing-date.aux &amp;&amp; exec</pre>

In script

<pre>exec("echo Hello world! &amp;&amp; date true", function(res) { console.log(res); })</pre>

history

Outputs the current console's history.

Examples:

Command line

<pre>history</pre>

l

Clearing the current console's output.

Examples:

Just type <i>l</i> and press Enter

<pre>l</pre>

man

Shows manual page about available commands.

Examples:

Command line

<pre>man</pre>

marker

Gives you ability to place markers on the current page. <i>screenshot</i> command could be used after that.

Examples:

Command line

<pre>marker</pre>

middleman

The command simply passes the given argument to its callback

Examples:

Command line (chaining)

<pre>date &amp;&amp; middleman &amp;&amp; echo</pre>

pass

Sometimes is needed to stop passing a result from one command to another. This command simply calls its callback without any arguments.

Examples:

Command line (chaining)

<pre>date true &amp;&amp; pass &amp;&amp; echo That's a string without date.</pre>

read

Extracts a value from json object

Examples:

Command line (chaining)

<pre>date true &amp;&amp; read day &amp;&amp; success Today is </pre>

If you have a complex object like this one {data: { users: [10, 11, 12] }}

<pre>read data.users[1]</pre>

request

Sends ajax request and returns the result.

Examples:

Command line

<pre>request github.com &amp;&amp; echo</pre>

Getting raw html

<pre>request github.com true &amp;&amp; echo</pre>

In script

<pre>This command is not supported in external scripts.</pre>

stringify

Just bypasses the given arguments as string

Examples:

Command line

<pre>date true &amp;&amp; stringify &amp;&amp; info</pre>

var

Define a variable.

Examples:

Command line

<pre>var n 10 echo $$n is a great position</pre>

Command line (chaining)

<pre>date &amp;&amp; var currentDate echo Current date is $$currentDate</pre>

data

alias

Managing aliases.

Examples:

Showing current added aliases

<pre>alias</pre>

Opening an editor for adding alias

<pre>alias my-alias-name</pre>

Directly pass the content of the alias

<pre>alias my-alias-name date &amp;&amp; echo</pre>

Clearing all aliases

<pre>alias clearallplease</pre>

Exporting all aliases

<pre>alias exportallplease</pre>

Command line (chaining)

<pre>readfile showing-date.aux &amp;&amp; exec</pre>

In script

<pre>alias('"my-alias-name"', "date &amp;&amp; echo", function() { console.log("Alias added."); })</pre>

profile

Manages your current profile file. Every time when you start auxilio the extension reads the files of the given directory (recursively). It searches for files which start with <i>function </i> and register them as commands. If the file starts with <i>exec.</i> directly executes the function inside the file. Check <i>man run</i> for more information.

Examples:

Getting current profile path

<pre>profile</pre>

Setting profile

<pre>profile D:/work/auxilio/profile</pre>

Clearing profile

<pre>profile clear</pre>

storage

Stores key-value pairs by using chrome.storage.sync API.

Examples:

Storing variable

<pre>storage put username Auxilio</pre>

Getting variable

<pre>storage get username</pre>

Removing variable

<pre>storage remove username</pre>

Get all variable

<pre>storage get</pre>

develop

editor

Opens an editor for editing files. Available shortcuts:<br /> Ctrl+S - save<br /> Esc - closing the editor<br /> Ctrl+[ - showing previous file<br /> Ctrl+] - showing next file<br />

Examples:

Open file for editing

<pre>editor ./styles.css</pre>

jshint

Formats an output of jshint execution. The command is meant to be used together with <i>watch</i>.

Examples:

Watching a javascript file for changes and passing the result to jshint.

<pre>watch start ./code.js jshint</pre>

runjasmine

Runs jasmine tests.

Examples:

Command line

<pre>runjasmine ./tests</pre>

forms

formconfirm

Shows a text (question) with two options - YES and NO.

Examples:

Command line

<pre>formconfirm Are you sure?</pre>

In script

<pre>formconfirm('"Are you sure?"', function(res) { console.log(res ? "yes" : "no"); });</pre>

formfile

Shows a simple form with input[type="file"] and button. Use the callback of the command to get the content of the file.

Examples:

Command line

<pre>formfile Please choose a file.</pre>

In script

<pre>formfile('"Please choose a file."', function(fileContent) { console.log(fileContent); })</pre>

forminput

Shows a simple form with input and button.

Examples:

Command line

<pre>forminput "Please type your age." 18</pre>

In script

<pre>forminput('"Please type your age."', 18, function(age) { console.log(age); });</pre>

formtextarea

Shows a simple form with textarea and button. Use the callback of the command to get the text submitted by the form.

Examples:

Command line

<pre>formtextarea "Please type your bio." "Sample text" &amp;&amp; echo</pre>

In script

<pre>formtextarea('"Please type your bio."', '"Sample text"', function(bio) { console.log(bio); });</pre>

games

tetris

Tetris game.

Examples:

Command line

<pre>tetris</pre>

messages

echo

Outputs message.

Examples:

Command line

<pre>echo Hello world!</pre>

In script

<pre>echo("Hello world!", function(res) { console.log(res); });</pre>

echoraw

Outputs message in raw format. Even the html is shown as string.

Examples:

Command line

<pre>echoraw Hello world!</pre>

In script

<pre>echoraw("Hello world!", function(res) { console.log(res); });</pre>

echoshell

Outputs message.

Examples:

Command line

<pre>echoshell Hello world!</pre>

In script

<pre>echoshell("Hello world!", function(res) { console.log(res); });</pre>

error

Outputs message.

Examples:

Command line

<pre>error Hello world!</pre>

In script

<pre>error("Hello world!", function(res) { console.log(res); });</pre>

hidden

Outputs invisible content. I.e. useful when you have to add hidden html markup.

Examples:

Command line

<pre>hidden &lt;input type="hidden" name="property" /></pre>

In script

<pre>hidden("&lt;input type="hidden" name="property" />", function(res) { console.log(res); });</pre>

hr

Adds <hr /> tag to the console's output panel

Examples:

Command line

<pre>hr</pre>

In script

<pre>hr();</pre>

info

Outputs message.

Examples:

Command line

<pre>info Hello world!</pre>

In script

<pre>info("Hello world!", function(res) { console.log(res); });</pre>

small

Outputs message.

Examples:

Command line

<pre>small Hello world!</pre>

In script

<pre>small("Hello world!", function(res) { console.log(res); });</pre>

success

Outputs message.

Examples:

Command line

<pre>success Hello world!</pre>

In script

<pre>success("Hello world!", function(res) { console.log(res); });</pre>

title

Outputs message.

Examples:

Command line

<pre>title Hello world!</pre>

In script

<pre>title("Hello world!", function(res) { console.log(res); });</pre>

warning

Outputs message.

Examples:

Command line

<pre>warning Hello world!</pre>

In script

<pre>warning("Hello world!", function(res) { console.log(res); });</pre>

os

block

Sometimes you need to execute a series of commands, but you want to keep the context, i.e. the current directory.

Examples:

Command line

<pre>block start &amp;&amp; cd ../../ &amp;&amp; echo Do some stuff here &amp;&amp; block end</pre>

In script

<pre>block("start", function() { shell("cd ../../", function() { block("end"); }); });</pre>

cwd

Returns the current working directory of auxilio-backend.

Examples:

Command line

<pre>cwd</pre>

In script

<pre>cwd(function(res) { console.log(res); });</pre>

readfile

Read content of a file.

Examples:

Command line

<pre>readfile ./README.md</pre>

In script

<pre>readfile("./README.md", function(content) { console.log(content); });</pre>

run

Register or execute commands stored in external files. The files should contain valid javascript which is actually a function definition in the following format:<pre>function nameOfMyFunction(args) { ...

}</pre>Normally the content of the file is registered as a command, but if the filename starts with <i>exec.</i> the function is executed immediately. For example:<pre>run ./exec.myscript.js</pre>

Examples:

Importing directory

<pre>run ./files</pre>

Importing file

<pre>run ./files/myscript.js</pre>

In script

<pre>run("./myfiles", function(res) { console.log(res); });</pre>

shell

Executes shell command. Have in mind that once you type something in the console and it doesn't match any of the auxilio's commands it is send to the shell

Examples:

Command line

<pre>shell ls</pre>

In script

<pre>shell("ls", function(res) { console.log(res); });</pre>

tree

Shows a directory tree.

Examples:

Command line

<pre>tree</pre>

Showing files by type

<pre>tree \.css</pre>

Showing only two levels

<pre>tree 2</pre>

Suppress the output to the console

<pre>tree suppressdisplay</pre>

In script

<pre>tree(2, function(res) { console.log(res); });</pre>

watch

Watch directory or file for changes.

Examples:

Get the current watchers and their ids

<pre>watch</pre>

Start watching

<pre>watch start ./ echo</pre>

Start watching and call multiple callbacks

<pre>watch start ./ "jshint, echo"</pre>

Stop watcher

<pre>watch stop 1</pre>

Stop all watchers

<pre>watch stopall</pre>

In script

<pre>watch("start", "./", "echo", function(res) { console.log(res); });</pre>

writefile

Write content to a file.

Examples:

Command line

<pre>writefile ./test.txt Sample text here.</pre>

In script

<pre>writefile("./test.txt", "Sample text here", function(res) { console.log("File saved successfully."); });</pre>

page

pageclick

Clicks an element on the page and returns the result immediately. Use <i>filter</i> parameter to filter the selected elements. Actually performs <i>indexOf</i> method agains the html markup of the selected element.

Examples:

Command line

<pre>pageclick "body > .my-link-class"</pre>

Filter the selected elements

<pre>pageclick "body > .my-link-class" "link label"</pre>

In script

<pre>pageclick("body > .my-link-class", function(res) { console.log("Element clicked."); });</pre>

pageclickw

Clicks an element on the page and waits till the page is updated. Use <i>filter</i> parameter to filter the selected elements. Actually performs <i>indexOf</i> method agains the html markup of the selected element.

Examples:

Command line

<pre>pageclickw "body > .my-link-class"</pre>

Filter the selected elements

<pre>pageclickw "body > .my-link-class" "link label"</pre>

In script

<pre>pageclickw("body > .my-link-class", function() { console.log("Element clicked."); });</pre>

pagecontains

Checks if there is an element matching the provided selector and containing the provided text.

Examples:

Command line

<pre>pagecontains "body > a" "my link"</pre>

In script

<pre>pagecontains("body > a", "my link", function(res) { console.log(res ? "yes" : "no"); });</pre>

pageexpect

Checks if there is an element matching the provided selector. Use <i>filter</i> parameter to filter the selected elements. Actually performs <i>indexOf</i> method agains the html markup of the selected element

Examples:

Command line

<pre>pageexpect a.my-link-class label</pre>

In script

<pre>pageexpect("a.my-link-class", "label, function(res) { console.log(res); });</pre>

pagehighlight

Highlights element/elements on the page. Use <i>filter</i> parameter to filter the selected elements. Actually performs <i>indexOf</i> method agains the html markup of the selected element.

Examples:

Command line

<pre>pagehighlight a</pre>

In script

<pre>pagehighlight("a", function(res) { console.log(res); });</pre>

pageinsertcss

Inserts css code in the context of the current page

Examples:

Command line

<pre>pageinsertcss body { background: #F00 !important; }</pre>

In script

<pre>pageinsertcss("body { background: #F00 !important; }", function() { console.log("CSS applied."); });</pre>

pageinsertjs

Executes javascript code in the context of the current page

Examples:

Command line

<pre>pageinsertjs "document.querySelector('body').click();"</pre>

In script

<pre>pageinsertjs("document.querySelector('body').click();", function(res) { console.log(res); });</pre>

pageinsertjsw

Executes javascript code in the context of the current page and waits till the current page is updated

Examples:

Command line

<pre>pageinsertjsw "document.querySelector('body').click();"</pre>

In script

<pre>pageinsertjsw("document.querySelector('body').click();", function(res) { console.log(res); });</pre>

pagequery

Returns the number of matched elements and the elements in raw html string format. Use <i>filter</i> parameter to filter the selected elements. Actually performs <i>indexOf</i> method agains the html markup of the selected element.

Examples:

Command line

<pre>pagequery a "label of the link"</pre>

In script (checks if there is links on the page)

<pre>pagequery("a", function(res) { console.log(res); });</pre>

tabs

load

Loads another page in the current tab.

Examples:

Command line

<pre>load github.com</pre>

In script

<pre>load("github.com", function() { console.log("new page loaded"); });</pre>

newtab

Creates a new tab.

Examples:

Command line

<pre>newtab github.com</pre>

In script

<pre>newtab("github.com", "false", function() { console.log("new tab loaded"); });</pre>

refresh

Refreshes the current tab's page

Examples:

Command line

<pre>refresh</pre>

In script

<pre>refresh(function() { console.log("The current page is refreshed."); });</pre>

screenshot

Makes a screenshot of the current tab and loads it in a new tab.

Examples:

Command line

<pre>screenshot</pre>

In script

<pre>screenshot(function() { console.log("The screenshot is made."); });</pre>