mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-06 11:35:54 +08:00
livebook server: Add --open-new
flag (#529)
* livebook server: Add `--open-new` flag * Update lib/livebook_cli/server.ex Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com> * Update lib/livebook_cli/server.ex * Update changelog Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
parent
e26159bce6
commit
01c079a697
2 changed files with 11 additions and 0 deletions
|
@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Introduced file system abstraction and an S3 support ([#492](https://github.com/livebook-dev/livebook/pull/492))
|
- Introduced file system abstraction and an S3 support ([#492](https://github.com/livebook-dev/livebook/pull/492))
|
||||||
- Added support for configuring file systems using env variables ([#498](https://github.com/livebook-dev/livebook/pull/498))
|
- Added support for configuring file systems using env variables ([#498](https://github.com/livebook-dev/livebook/pull/498))
|
||||||
- Added a keyboard shortcut for triggering on-hover docs ([#508](https://github.com/livebook-dev/livebook/pull/508))
|
- Added a keyboard shortcut for triggering on-hover docs ([#508](https://github.com/livebook-dev/livebook/pull/508))
|
||||||
|
- Added `--open-new` CLI flag to `livebook server` ([#529](https://github.com/livebook-dev/livebook/pull/529))
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ defmodule LivebookCLI.Server do
|
||||||
--no-token Disable token authentication, enabled by default
|
--no-token Disable token authentication, enabled by default
|
||||||
If LIVEBOOK_PASSWORD is set, it takes precedence over token auth
|
If LIVEBOOK_PASSWORD is set, it takes precedence over token auth
|
||||||
--open Open browser window pointing to the application
|
--open Open browser window pointing to the application
|
||||||
|
--open-new Open browser window pointing to a new notebook
|
||||||
-p, --port The port to start the web application on, defaults to 8080
|
-p, --port The port to start the web application on, defaults to 8080
|
||||||
--root-path The root path to use for file selection
|
--root-path The root path to use for file selection
|
||||||
--sname Set a short name for the app distributed node
|
--sname Set a short name for the app distributed node
|
||||||
|
@ -58,6 +59,14 @@ defmodule LivebookCLI.Server do
|
||||||
browser_open(LivebookWeb.Endpoint.access_url())
|
browser_open(LivebookWeb.Endpoint.access_url())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts[:open_new] do
|
||||||
|
LivebookWeb.Endpoint.access_url()
|
||||||
|
|> URI.parse()
|
||||||
|
|> Map.update!(:path, &((&1 || "/") <> "explore/notebooks/new"))
|
||||||
|
|> URI.to_string()
|
||||||
|
|> browser_open()
|
||||||
|
end
|
||||||
|
|
||||||
Process.sleep(:infinity)
|
Process.sleep(:infinity)
|
||||||
|
|
||||||
:error ->
|
:error ->
|
||||||
|
@ -92,6 +101,7 @@ defmodule LivebookCLI.Server do
|
||||||
ip: :string,
|
ip: :string,
|
||||||
name: :string,
|
name: :string,
|
||||||
open: :boolean,
|
open: :boolean,
|
||||||
|
open_new: :boolean,
|
||||||
port: :integer,
|
port: :integer,
|
||||||
root_path: :string,
|
root_path: :string,
|
||||||
sname: :string,
|
sname: :string,
|
||||||
|
|
Loading…
Add table
Reference in a new issue