Extension for Google Chrome
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is even with krasimir:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
design
src
tasks
tests
tpl
.gitignore
Gruntfile.js
README.md
commands.md
package.json

README.md

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:

  • interactive shell/console

  • file browser

  • front-end testing

  • real-time code editing

  • git helper

  • project manager / workflow optimization

  • profiling

  • marker

  • playing tetris :)

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:

  • it's simply JavaScript and I'm able to write whatever I want
  • it has a lot of modules, which I can use.

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.

  • Open this url and click Add to Chrome button in the upper right corner.
    Auxilio
  • Download the source code from the GitHub repo. Open chrome://extensions page and check Developer mode. After that click on Load unpacked extension and browse the /src directory.
    Auxilio

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

  • Download the source code of the extension (you will use the content of the src folder)

  • Open Google Chrome and type the following thing in the address bar

    chrome://extensions
    
  • Check the Developer mode option

  • Click on Load unpacked extension... and browse the src folder

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.

  • format: clear
  • returns: null

Examples:

clear

In script

clear()

compare

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

  • format: compare [title] [value1] [expression] [value2]
  • returns: Boolean (true | false)

Examples:

Command line

compare "Check those values" 10 == 20

Command line (chaining)

date true && read monthName && compare "Is it July?" July ==

In script

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

date

Gets the current date.

  • format: date [true | false]
  • returns: String if you use just date and object if use data true
    6 July 2013 14:43
    Object {
    day: 6
    hour: 14
    minutes: 41
    month: 6
    monthName: "July"
    year: 2013
    }		

Examples:

Command line

date

Command line (chaining)

date true && read monthName && info

In script

date("true", function(date) {
	console.log(date.year);
})

delay

Delays the next command

  • format: delay [miliseconds]
  • returns: null

Examples:

Command line

delay 2000

Command line (chaining)

echo A && delay 2000 && echo B

In script

delay(2000, function() {
	console.log("hello");
})

diff

Comparison of files (text and json) or strings.

  • format: diff
    diff [string1] [string2]
  • returns: Object containing the differences.

Examples:

Opens a browse window for picking two files

diff

Comparing two strings

diff "Hello world!" "Hello world, dude!"

Command line (chaining)

date true && read monthName && diff "Current month is July"

In script

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

exec

Executes a given command. Accepts commands separated by &&.

  • format: exec [command/s]
  • returns: The result of the executed command.

Examples:

Command line

exec echo "test"

Command line (chaining)

readfile showing-date.aux && exec

In script

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

history

Outputs the current console's history.

  • format: history
  • returns: null

Examples:

Command line

history

l

Clearing the current console's output.

  • format: l
  • returns: null

Examples:

Just type l and press Enter

l

man

Shows manual page about available commands.

  • format: man
    man [regex | name of a command]
    man exporttomarkdown
  • returns: Manual page/s

Examples:

Command line

man

marker

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

  • format: marker
  • returns: null

Examples:

Command line

marker

middleman

The command simply passes the given argument to its callback

  • format: middleman [resource]
  • returns: The result of the previous command in the chain.

Examples:

Command line (chaining)

date && middleman && echo

pass

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

  • format: pass
  • returns: null

Examples:

Command line (chaining)

date true && pass && echo That's a string without date.

read

Extracts a value from json object

  • format: read [path] [json object]
  • returns: Value of a property of the sent object

Examples:

Command line (chaining)

date true && read day && success Today is 

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

read data.users[1]

request

Sends ajax request and returns the result.

  • format: request [url]
    request [url] [raw (true | false)]
  • returns: Response of the given url or the raw output if raw parameter is passed.

Examples:

Command line

request github.com && echo

Getting raw html

request github.com true && echo

In script

This command is not supported in external scripts.

stringify

Just bypasses the given arguments as string

  • format: stringify [text or object]
  • returns: string

Examples:

Command line

date true && stringify && info

var

Define a variable.

  • format: var [name] [value]
  • returns: The value of the variable

Examples:

Command line

var n 10
echo $$n is a great position

Command line (chaining)

date && var currentDate
echo Current date is $$currentDate

data

alias

Managing aliases.

  • format: alias [name] [value]
  • returns: Check the examples.

Examples:

Showing current added aliases

alias

Opening an editor for adding alias

alias my-alias-name

Directly pass the content of the alias

alias my-alias-name date && echo

Clearing all aliases

alias clearallplease

Exporting all aliases

alias exportallplease

Command line (chaining)

readfile showing-date.aux && exec

In script

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

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 function and register them as commands. If the file starts with exec. directly executes the function inside the file. Check man run for more information.

  • format: profile [path]
  • returns: Check examples.

Examples:

Getting current profile path

profile

Setting profile

profile D:/work/auxilio/profile

Clearing profile

profile clear

storage

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

  • format: storage [operation] [key] [value]
  • returns: The result of the executed command.

Examples:

Storing variable

storage put username Auxilio

Getting variable

storage get username

Removing variable

storage remove username

Get all variable

storage get

develop

editor

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

  • format: editor [file]
  • returns: null

Examples:

Open file for editing

editor ./styles.css

jshint

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

  • format: jshint [{filePath: [path], jshint: [jshint]}]
  • returns: null

Examples:

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

watch start ./code.js jshint

runjasmine

Runs jasmine tests.

  • format: runjasmine [path]
  • returns: null

Examples:

Command line

runjasmine ./tests

forms

formconfirm

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

  • format: formconfirm [question]
  • returns: Boolean (true | false)

Examples:

Command line

formconfirm Are you sure?

In script

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

formfile

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

  • format: formfile [title]
  • returns: Content of the file

Examples:

Command line

formfile Please choose a file.

In script

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

forminput

Shows a simple form with input and button.

  • format: forminput
    forminput [title]
    forminput [title] [default text]
  • returns: string

Examples:

Command line

forminput "Please type your age." 18

In script

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

formtextarea

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

  • format: formtextarea
    formtextarea [title]
    formtextarea [title] [text]
  • returns: string

Examples:

Command line

formtextarea "Please type your bio." "Sample text" && echo

In script

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

games

tetris

Tetris game.

  • format: tetris
    tetris [level to start from]
  • returns: null

Examples:

Command line

tetris

messages

echo

Outputs message.

  • format: echo [text]
  • returns: string

Examples:

Command line

echo Hello world!

In script

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

echoraw

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

  • format: echoraw [text]
  • returns: string

Examples:

Command line

echoraw Hello world!

In script

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

echoshell

Outputs message.

  • format: echoshell [text]
  • returns: string

Examples:

Command line

echoshell Hello world!

In script

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

error

Outputs message.

  • format: error [text]
  • returns: string

Examples:

Command line

error Hello world!

In script

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

hidden

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

  • format: hidden [text]
  • returns: string

Examples:

Command line

hidden <input type="hidden" name="property" />

In script

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

hr

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

  • format: hr
  • returns: null

Examples:

Command line

hr

In script

hr();

info

Outputs message.

  • format: info [text]
  • returns: string

Examples:

Command line

info Hello world!

In script

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

small

Outputs message.

  • format: small [text]
  • returns: string

Examples:

Command line

small Hello world!

In script

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

success

Outputs message.

  • format: success [text]
  • returns: string

Examples:

Command line

success Hello world!

In script

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

title

Outputs message.

  • format: title [text]
  • returns: string

Examples:

Command line

title Hello world!

In script

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

warning

Outputs message.

  • format: warning [text]
  • returns: string

Examples:

Command line

warning Hello world!

In script

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

os

block

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

  • format: block [operation]
  • returns: null

Examples:

Command line

block start && cd ../../ && echo Do some stuff here && block end

In script

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

cwd

Returns the current working directory of auxilio-backend.

  • format: cwd
  • returns: string

Examples:

Command line

cwd

In script

cwd(function(res) {
	console.log(res);
});

readfile

Read content of a file.

  • format: readfile [file]
  • returns: string

Examples:

Command line

readfile ./README.md

In script

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

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:

function nameOfMyFunction(args) {
...

}

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

  • format: run [path]
  • returns: Result of the function.

Examples:

Importing directory

run ./files

Importing file

run ./files/myscript.js

In script

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

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

  • format: shell [command]
  • returns: string

Examples:

Command line

shell ls

In script

shell("ls", function(res) {
	console.log(res);
});

tree

Shows a directory tree.

  • format: tree
    tree [regex]
    tree [deep]
    tree [suppressdisplay]
  • returns: string

Examples:

Command line

tree

Showing files by type

tree \.css

Showing only two levels

tree 2

Suppress the output to the console

tree suppressdisplay

In script

tree(2, function(res) {
	console.log(res);
});

watch

Watch directory or file for changes.

  • format: watch [operation] [id or path] [callback command]
  • returns: string

Examples:

Get the current watchers and their ids

watch

Start watching

watch start ./ echo

Start watching and call multiple callbacks

watch start ./ "jshint, echo"

Stop watcher

watch stop 1

Stop all watchers

watch stopall

In script

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

writefile

Write content to a file.

  • format: writefile [file] [content]
  • returns: string

Examples:

Command line

writefile ./test.txt Sample text here.

In script

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

page

pageclick

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

  • format: pageclick [selector] [filter]
  • returns: Object containing the matched elements.

Examples:

Command line

pageclick "body > .my-link-class"

Filter the selected elements

pageclick "body > .my-link-class" "link label"

In script

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

pageclickw

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

  • format: pageclickw [selector] [filter]
  • returns: Object containing the matched elements.

Examples:

Command line

pageclickw "body > .my-link-class"

Filter the selected elements

pageclickw "body > .my-link-class" "link label"

In script

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

pagecontains

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

  • format: pagecontains [selector] [text]
  • returns: Boolean (true | false)

Examples:

Command line

pagecontains "body > a" "my link"

In script

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

pageexpect

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

  • format: pageexpect [selector] [filter]
  • returns: Object containing the matched elements.

Examples:

Command line

pageexpect a.my-link-class label

In script

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

pagehighlight

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

  • format: pagehighlight [selector] [filter]
  • returns: Object containing the matched elements.

Examples:

Command line

pagehighlight a

In script

pagehighlight("a", function(res) {
	console.log(res);
});

pageinsertcss

Inserts css code in the context of the current page

  • format: pageinsertcss [css code]
  • returns: string

Examples:

Command line

pageinsertcss body { background: #F00 !important; }

In script

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

pageinsertjs

Executes javascript code in the context of the current page

  • format: pageinsertjs [js code]
  • returns: string

Examples:

Command line

pageinsertjs "document.querySelector('body').click();"

In script

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

pageinsertjsw

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

  • format: pageinsertjsw [js code]
  • returns: string

Examples:

Command line

pageinsertjsw "document.querySelector('body').click();"

In script

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

pagequery

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

  • format: pagequery [selector] [filter]
  • returns: Object containing the matched elements.

Examples:

Command line

pagequery a "label of the link"

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

pagequery("a", function(res) {
	console.log(res);
});

tabs

load

Loads another page in the current tab.

  • format: load [url]
  • returns: null

Examples:

Command line

load github.com

In script

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

newtab

Creates a new tab.

  • format: newtab
    newtab [url] [active (true | false)]
  • returns: null

Examples:

Command line

newtab github.com

In script

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

refresh

Refreshes the current tab's page

  • format: refresh
  • returns: null

Examples:

Command line

refresh

In script

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

screenshot

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

  • format: screenshot
  • returns: null

Examples:

Command line

screenshot

In script

screenshot(function() {
	console.log("The screenshot is made.");
});