Skip to content

Commit af2549f

Browse files
authored
Merge pull request #5 from suyashmahar/dev
Europa v1.1.0
2 parents a5f4730 + a0ababd commit af2549f

File tree

3 files changed

+87
-8
lines changed

3 files changed

+87
-8
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ Europa supports all the keyboard shortcuts for JupyterLab that you'd expect in a
1212
# Installation
1313
You can either grab a portable app for linux/windows or grab OS specific installer from the [releases](https://github.com/suyashmahar/europa/releases).
1414

15+
### Debian/Ubuntu
16+
17+
```
18+
curl -s --compressed "https://europa-sources.suyashmahar.com/debian/KEY.gpg" | sudo apt-key add -
19+
sudo curl -s --compressed -o /etc/apt/sources.list.d/europa.list "https://europa-sources.suyashmahar.com/debian/europa.list"
20+
sudo apt update && sudo apt-get install europa
21+
```
22+
23+
## CLI
24+
Europa supports a CLI interface:
25+
```
26+
USAGE:
27+
/tmp/.mount_europaZ88iLd/europa [options]
28+
29+
OPTIONS:
30+
-u,--url <url> Open a europa window for <url> on start.
31+
-v,--version Print version number and exit.
32+
-h,--help Print this help message and exit.
33+
```
34+
1535
# Demo
1636
(YouTube)
1737
[![Europa Demo video](https://imgur.com/download/dyLvkW8/)](https://www.youtube.com/watch?v=Qg6RwUoB6G0)

src/main.js

+66-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const MAX_RECENT_ITEMS = 4
2525
const SHORTCUT_SEND_URL = `/lab/api/settings/@jupyterlab/shortcuts-extension:shortcuts`
2626
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'
2727
const DRAW_FRAME = true
28-
const VERSION_STRING = '1.0.0'
28+
const VERSION_STRING = '1.1.0'
2929

3030
/* Create all the data stores */
3131
const recentUrlsDb = new RecentUrlsDB({ name: 'recent_urls' })
@@ -644,20 +644,76 @@ function addRecentURLListeners () {
644644
})
645645
}
646646

647+
function printCLIHeader() {
648+
console.log("Europa " + VERSION_STRING)
649+
}
650+
651+
function printCLIHelp(args, header, stderr) {
652+
let log_obj
653+
654+
if (stderr) {
655+
log_obj = console.error
656+
} else {
657+
log_obj = console.log
658+
}
659+
660+
if (header) {
661+
printCLIHeader()
662+
log_obj("")
663+
}
664+
665+
log_obj("USAGE:\n\t" + args[0] + " [options]")
666+
log_obj()
667+
log_obj("OPTIONS:")
668+
log_obj("\t-u,--url <url> \tOpen a europa window for <url> on start.")
669+
log_obj("\t-v,--version \tPrint version number and exit.")
670+
log_obj("\t-h,--help \tPrint this help message and exit.")
671+
log_obj()
672+
log_obj("OTHER:")
673+
log_obj("\tCopyright (c) 2020-21 Europa Authors")
674+
log_obj("\tReport bugs at: https://europa.suyashmahar.com/report-bugs")
675+
}
676+
677+
function printCLIVersion() {
678+
printCLIHeader();
679+
}
680+
647681
/**
648682
* Parse command line arguments
649683
*/
650684
function parseCmdlineArgs() {
651685
let args = process.argv
652-
console.log(args)
653-
654-
for (let i = 0; i < args.length; i++) {
655-
686+
let result = {'url': ''}
687+
688+
for (let i = 1; i < args.length; i++) {
689+
if (args[i] == "--help" || args[i] == "-h") {
690+
printCLIHelp(args, true)
691+
app.exit(0)
692+
} else if (args[i] == "--version" || args[i] == "-v") {
693+
printCLIVersion()
694+
app.exit(0)
695+
} else if (args[i] == "--url" || args[i] == "-u") {
696+
if (args.length < i + 2) {
697+
console.error("--url requires exactly one argument")
698+
console.error()
699+
printCLIHelp(args, false, true)
700+
}
701+
702+
result['url'] = args[i + 1]
703+
i += 1
704+
} else {
705+
console.error("Unknown argument '" + args[i] + "'")
706+
console.error()
707+
printCLIHelp(args, false, true)
708+
app.exit(1)
709+
}
656710
}
711+
712+
return result
657713
}
658714

659715
function main () {
660-
parseCmdlineArgs()
716+
let args = parseCmdlineArgs()
661717

662718
fixASARPath()
663719

@@ -691,6 +747,10 @@ function main () {
691747
ipcMain.on('open-url', showEuropaBrowser)
692748
ipcMain.on('show-about-europa', e => showAboutDialog(e.sender))
693749
ipcMain.on('dialog-result', (event, id, resp) => dialogRespTracker[id](resp))
750+
751+
if (args['url'] != "") {
752+
showEuropaBrowser(null, args.url)
753+
}
694754
}
695755

696756
app.on('ready', main)

src/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "europa",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "JupyterLab's Desktop client",
55
"homepage": "europa.suyashmahar.com",
66
"author": {
@@ -48,7 +48,6 @@
4848
"rpm",
4949
"freebsd",
5050
"pacman",
51-
"fedora",
5251
"zip",
5352
"tar.xz",
5453
"tar.gz"

0 commit comments

Comments
 (0)