Skip to content

Commit

Permalink
Merge pull request #5 from suyashmahar/dev
Browse files Browse the repository at this point in the history
Europa v1.1.0
  • Loading branch information
suyashmahar authored Dec 19, 2021
2 parents a5f4730 + a0ababd commit af2549f
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 8 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ Europa supports all the keyboard shortcuts for JupyterLab that you'd expect in a
# Installation
You can either grab a portable app for linux/windows or grab OS specific installer from the [releases](https://github.com/suyashmahar/europa/releases).

### Debian/Ubuntu

```
curl -s --compressed "https://europa-sources.suyashmahar.com/debian/KEY.gpg" | sudo apt-key add -
sudo curl -s --compressed -o /etc/apt/sources.list.d/europa.list "https://europa-sources.suyashmahar.com/debian/europa.list"
sudo apt update && sudo apt-get install europa
```

## CLI
Europa supports a CLI interface:
```
USAGE:
/tmp/.mount_europaZ88iLd/europa [options]
OPTIONS:
-u,--url <url> Open a europa window for <url> on start.
-v,--version Print version number and exit.
-h,--help Print this help message and exit.
```

# Demo
(YouTube)
[![Europa Demo video](https://imgur.com/download/dyLvkW8/)](https://www.youtube.com/watch?v=Qg6RwUoB6G0)
Expand Down
72 changes: 66 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MAX_RECENT_ITEMS = 4
const SHORTCUT_SEND_URL = `/lab/api/settings/@jupyterlab/shortcuts-extension:shortcuts`
const USER_AGENT_STR = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
const DRAW_FRAME = true
const VERSION_STRING = '1.0.0'
const VERSION_STRING = '1.1.0'

/* Create all the data stores */
const recentUrlsDb = new RecentUrlsDB({ name: 'recent_urls' })
Expand Down Expand Up @@ -644,20 +644,76 @@ function addRecentURLListeners () {
})
}

function printCLIHeader() {
console.log("Europa " + VERSION_STRING)
}

function printCLIHelp(args, header, stderr) {
let log_obj

if (stderr) {
log_obj = console.error
} else {
log_obj = console.log
}

if (header) {
printCLIHeader()
log_obj("")
}

log_obj("USAGE:\n\t" + args[0] + " [options]")
log_obj()
log_obj("OPTIONS:")
log_obj("\t-u,--url <url> \tOpen a europa window for <url> on start.")
log_obj("\t-v,--version \tPrint version number and exit.")
log_obj("\t-h,--help \tPrint this help message and exit.")
log_obj()
log_obj("OTHER:")
log_obj("\tCopyright (c) 2020-21 Europa Authors")
log_obj("\tReport bugs at: https://europa.suyashmahar.com/report-bugs")
}

function printCLIVersion() {
printCLIHeader();
}

/**
* Parse command line arguments
*/
function parseCmdlineArgs() {
let args = process.argv
console.log(args)

for (let i = 0; i < args.length; i++) {

let result = {'url': ''}

for (let i = 1; i < args.length; i++) {
if (args[i] == "--help" || args[i] == "-h") {
printCLIHelp(args, true)
app.exit(0)
} else if (args[i] == "--version" || args[i] == "-v") {
printCLIVersion()
app.exit(0)
} else if (args[i] == "--url" || args[i] == "-u") {
if (args.length < i + 2) {
console.error("--url requires exactly one argument")
console.error()
printCLIHelp(args, false, true)
}

result['url'] = args[i + 1]
i += 1
} else {
console.error("Unknown argument '" + args[i] + "'")
console.error()
printCLIHelp(args, false, true)
app.exit(1)
}
}

return result
}

function main () {
parseCmdlineArgs()
let args = parseCmdlineArgs()

fixASARPath()

Expand Down Expand Up @@ -691,6 +747,10 @@ function main () {
ipcMain.on('open-url', showEuropaBrowser)
ipcMain.on('show-about-europa', e => showAboutDialog(e.sender))
ipcMain.on('dialog-result', (event, id, resp) => dialogRespTracker[id](resp))

if (args['url'] != "") {
showEuropaBrowser(null, args.url)
}
}

app.on('ready', main)
Expand Down
3 changes: 1 addition & 2 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "europa",
"version": "1.0.0",
"version": "1.1.0",
"description": "JupyterLab's Desktop client",
"homepage": "europa.suyashmahar.com",
"author": {
Expand Down Expand Up @@ -48,7 +48,6 @@
"rpm",
"freebsd",
"pacman",
"fedora",
"zip",
"tar.xz",
"tar.gz"
Expand Down

0 comments on commit af2549f

Please sign in to comment.