Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krasimir/auxilio
Extension for Google Chrome
https://github.com/krasimir/auxilio
Last synced: 3 days ago
JSON representation
Extension for Google Chrome
- Host: GitHub
- URL: https://github.com/krasimir/auxilio
- Owner: krasimir
- Created: 2013-03-10T19:10:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-30T07:37:45.000Z (about 11 years ago)
- Last Synced: 2024-04-11T07:12:24.408Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.76 MB
- Stars: 32
- Watchers: 7
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://chrome.google.com/webstore/detail/auxilio/ddkgloamdhkoohfgmopdicfcinddpnhh) is an extension for [Google Chrome](https://www.google.com/intl/en/chrome/browser/) 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](https://chrome.google.com/webstore/detail/auxilio/ddkgloamdhkoohfgmopdicfcinddpnhh) 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](http://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](https://developer.chrome.com/extensions/getstarted.html), while the back-end is taking care about the OS related stuff. The extension just sends commands and gets response.
![Auxilio](http://krasimirtsonev.com/blog/articles/Auxilio/architecture.jpg)
## Installation
### Auxilio back-end
First of all install NodeJS. It's pretty easy. Just go to [nodejs.org](http://nodejs.org/) and click the big green button. The back-end is distributed as node [package](http://npmjs.org), 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](https://chrome.google.com/webstore/detail/auxilio/ddkgloamdhkoohfgmopdicfcinddpnhh) and click *Add to Chrome* button in the upper right corner.
![Auxilio](http://krasimirtsonev.com/blog/articles/Auxilio/installing1.jpg)
- Download the source code from [the GitHub repo](https://github.com/krasimir/auxilio). Open *chrome://extensions* page and check *Developer mode*. After that click on *Load unpacked extension* and browse the */src* directory.
![Auxilio](http://krasimirtsonev.com/blog/articles/Auxilio/installing2.jpg)## 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](http://krasimirtsonev.com/blog/articles/Auxilio/newtab.jpg)
### DevTools tab
DevTools is a great instrument for programmers. Luckily there is an [API](https://developer.chrome.com/extensions/devtools.html) 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](http://krasimirtsonev.com/blog/articles/Auxilio/devtools.jpg)
## In Google Chrome web store
[Auxilio](https://chrome.google.com/webstore/detail/auxilio/ddkgloamdhkoohfgmopdicfcinddpnhh)
## 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 barchrome://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](http://krasimirtsonev.com/blog/article/Auxilio-Chrome-extension-or-how-I-boost-my-productivity)
# Documentation
## common
### clear
Clearing the current console's output.
- format: clear
- returns: null#### Examples:
clear
In scriptclear()
### compareCompares 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 scriptcompare('"My title here"', 10, "==", 10, function(res) {
console.log(res);
})
### dateGets the current date.
- format: date [true | false]
- returns: String if you use just date and object if use data true6 July 2013 14:43Object {
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 scriptdate("true", function(date) {
console.log(date.year);
})
### delayDelays the next command
- format: delay [miliseconds]
- returns: null#### Examples:
Command line
delay 2000
Command line (chaining)echo A && delay 2000 && echo B
In scriptdelay(2000, function() {
console.log("hello");
})
### diffComparison 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 stringsdiff "Hello world!" "Hello world, dude!"
Command line (chaining)date true && read monthName && diff "Current month is July"
In scriptdiff('"Hello world!"', '"Hello world dude!"', function(res) {
console.log(res);
})
### execExecutes 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 scriptexec("echo Hello world! && date true", function(res) {
console.log(res);
})
### historyOutputs the current console's history.
- format: history
- returns: null#### Examples:
Command line
history
### lClearing the current console's output.
- format: l
- returns: null#### Examples:
Just type l and press Enter
l
### manShows manual page about available commands.
- format: man
man [regex | name of a command]
man exporttomarkdown
- returns: Manual page/s#### Examples:
Command line
man
### markerGives you ability to place markers on the current page. screenshot command could be used after that.
- format: marker
- returns: null#### Examples:
Command line
marker
### middlemanThe 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
### passSometimes 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.
### readExtracts 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]
### requestSends 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 htmlrequest github.com true && echo
In scriptThis command is not supported in external scripts.
### stringifyJust bypasses the given arguments as string
- format: stringify [text or object]
- returns: string#### Examples:
Command line
date true && stringify && info
### varDefine 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 aliasalias my-alias-name
Directly pass the content of the aliasalias my-alias-name date && echo
Clearing all aliasesalias clearallplease
Exporting all aliasesalias exportallplease
Command line (chaining)readfile showing-date.aux && exec
In scriptalias('"my-alias-name"', "date && echo", function() {
console.log("Alias added.");
})
### profileManages 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 profileprofile D:/work/auxilio/profile
Clearing profileprofile clear
### storageStores 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 variablestorage get username
Removing variablestorage remove username
Get all variablestorage 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
### jshintFormats 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
### runjasmineRuns 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 scriptformconfirm('"Are you sure?"', function(res) {
console.log(res ? "yes" : "no");
});
### formfileShows 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 scriptformfile('"Please choose a file."', function(fileContent) {
console.log(fileContent);
})
### forminputShows 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 scriptforminput('"Please type your age."', 18, function(age) {
console.log(age);
});
### formtextareaShows 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 scriptformtextarea('"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 scriptecho("Hello world!", function(res) {
console.log(res);
});
### echorawOutputs message in raw format. Even the html is shown as string.
- format: echoraw [text]
- returns: string#### Examples:
Command line
echoraw Hello world!
In scriptechoraw("Hello world!", function(res) {
console.log(res);
});
### echoshellOutputs message.
- format: echoshell [text]
- returns: string#### Examples:
Command line
echoshell Hello world!
In scriptechoshell("Hello world!", function(res) {
console.log(res);
});
### errorOutputs message.
- format: error [text]
- returns: string#### Examples:
Command line
error Hello world!
In scripterror("Hello world!", function(res) {
console.log(res);
});
### hiddenOutputs 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 scripthidden("<input type="hidden" name="property" />", function(res) {
console.log(res);
});
### hrAdds <hr /> tag to the console's output panel
- format: hr
- returns: null#### Examples:
Command line
hr
In scripthr();
### infoOutputs message.
- format: info [text]
- returns: string#### Examples:
Command line
info Hello world!
In scriptinfo("Hello world!", function(res) {
console.log(res);
});
### smallOutputs message.
- format: small [text]
- returns: string#### Examples:
Command line
small Hello world!
In scriptsmall("Hello world!", function(res) {
console.log(res);
});
### successOutputs message.
- format: success [text]
- returns: string#### Examples:
Command line
success Hello world!
In scriptsuccess("Hello world!", function(res) {
console.log(res);
});
### titleOutputs message.
- format: title [text]
- returns: string#### Examples:
Command line
title Hello world!
In scripttitle("Hello world!", function(res) {
console.log(res);
});
### warningOutputs message.
- format: warning [text]
- returns: string#### Examples:
Command line
warning Hello world!
In scriptwarning("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 scriptblock("start", function() {
shell("cd ../../", function() {
block("end");
});
});
### cwdReturns the current working directory of auxilio-backend.
- format: cwd
- returns: string#### Examples:
Command line
cwd
In scriptcwd(function(res) {
console.log(res);
});
### readfileRead content of a file.
- format: readfile [file]
- returns: string#### Examples:
Command line
readfile ./README.md
In scriptreadfile("./README.md", function(content) {
console.log(content);
});
### runRegister 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 filerun ./files/myscript.js
In scriptrun("./myfiles", function(res) {
console.log(res);
});
### shellExecutes 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 scriptshell("ls", function(res) {
console.log(res);
});
### treeShows a directory tree.
- format: tree
tree [regex]
tree [deep]
tree [suppressdisplay]
- returns: string#### Examples:
Command line
tree
Showing files by typetree \.css
Showing only two levelstree 2
Suppress the output to the consoletree suppressdisplay
In scripttree(2, function(res) {
console.log(res);
});
### watchWatch 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 watchingwatch start ./ echo
Start watching and call multiple callbackswatch start ./ "jshint, echo"
Stop watcherwatch stop 1
Stop all watcherswatch stopall
In scriptwatch("start", "./", "echo", function(res) {
console.log(res);
});
### writefileWrite content to a file.
- format: writefile [file] [content]
- returns: string#### Examples:
Command line
writefile ./test.txt Sample text here.
In scriptwritefile("./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 elementspageclick "body > .my-link-class" "link label"
In scriptpageclick("body > .my-link-class", function(res) {
console.log("Element clicked.");
});
### pageclickwClicks 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 elementspageclickw "body > .my-link-class" "link label"
In scriptpageclickw("body > .my-link-class", function() {
console.log("Element clicked.");
});
### pagecontainsChecks 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 scriptpagecontains("body > a", "my link", function(res) {
console.log(res ? "yes" : "no");
});
### pageexpectChecks 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 scriptpageexpect("a.my-link-class", "label, function(res) {
console.log(res);
});
### pagehighlightHighlights 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 scriptpagehighlight("a", function(res) {
console.log(res);
});
### pageinsertcssInserts css code in the context of the current page
- format: pageinsertcss [css code]
- returns: string#### Examples:
Command line
pageinsertcss body { background: #F00 !important; }
In scriptpageinsertcss("body { background: #F00 !important; }", function() {
console.log("CSS applied.");
});
### pageinsertjsExecutes javascript code in the context of the current page
- format: pageinsertjs [js code]
- returns: string#### Examples:
Command line
pageinsertjs "document.querySelector('body').click();"
In scriptpageinsertjs("document.querySelector('body').click();", function(res) {
console.log(res);
});
### pageinsertjswExecutes 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 scriptpageinsertjsw("document.querySelector('body').click();", function(res) {
console.log(res);
});
### pagequeryReturns 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 scriptload("github.com", function() {
console.log("new page loaded");
});
### newtabCreates a new tab.
- format: newtab
newtab [url] [active (true | false)]
- returns: null#### Examples:
Command line
newtab github.com
In scriptnewtab("github.com", "false", function() {
console.log("new tab loaded");
});
### refreshRefreshes the current tab's page
- format: refresh
- returns: null#### Examples:
Command line
refresh
In scriptrefresh(function() {
console.log("The current page is refreshed.");
});
### screenshotMakes a screenshot of the current tab and loads it in a new tab.
- format: screenshot
- returns: null#### Examples:
Command line
screenshot
In scriptscreenshot(function() {
console.log("The screenshot is made.");
});