diff --git a/CHANGELOG.md b/CHANGELOG.md index d942f78aa..8b304b790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/livebook_cli/server.ex b/lib/livebook_cli/server.ex index 25f7588bc..40a7ea37f 100644 --- a/lib/livebook_cli/server.ex +++ b/lib/livebook_cli/server.ex @@ -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,