mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-07 05:24:40 +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))
|
||||
- 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 `--open-new` CLI flag to `livebook server` ([#529](https://github.com/livebook-dev/livebook/pull/529))
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ defmodule LivebookCLI.Server do
|
|||
--no-token Disable token authentication, enabled by default
|
||||
If LIVEBOOK_PASSWORD is set, it takes precedence over token auth
|
||||
--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
|
||||
--root-path The root path to use for file selection
|
||||
--sname Set a short name for the app distributed node
|
||||
|
@ -58,6 +59,14 @@ defmodule LivebookCLI.Server do
|
|||
browser_open(LivebookWeb.Endpoint.access_url())
|
||||
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)
|
||||
|
||||
:error ->
|
||||
|
@ -92,6 +101,7 @@ defmodule LivebookCLI.Server do
|
|||
ip: :string,
|
||||
name: :string,
|
||||
open: :boolean,
|
||||
open_new: :boolean,
|
||||
port: :integer,
|
||||
root_path: :string,
|
||||
sname: :string,
|
||||
|
|
Loading…
Add table
Reference in a new issue