Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livebook server: Add --open-new flag #529

Merged
merged 4 commits into from
Aug 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/livebook_cli/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 livebook
wojtekmach marked this conversation as resolved.
Show resolved Hide resolved
-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
Expand All @@ -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"))
wojtekmach marked this conversation as resolved.
Show resolved Hide resolved
|> URI.to_string()
|> browser_open()
end

Process.sleep(:infinity)

:error ->
Expand Down Expand Up @@ -92,6 +101,7 @@ defmodule LivebookCLI.Server do
ip: :string,
name: :string,
open: :boolean,
open_new: :boolean,
port: :integer,
root_path: :string,
sname: :string,
Expand Down