Skip to content

v0.6.2

Compare
Choose a tag to compare
@ayushkamat ayushkamat released this 19 Mar 22:53
· 2640 commits to main since this release

This version introduces four new CLI subcommands:

latch open

A Latch SDK user can now open a remote file in their browser directly from the command line.

Usage: latch open [OPTIONS] REMOTE_FILE

  Open a remote file in the browser

  Visit docs.latch.bio to learn more.

This allows a user to view any of their files in Latch Console using a single CLI command - for example, $ latch open welcome/welcome.pdf will open welcome.pdf in Latch Console in the user's browser. In general, the user can provide as input either

  • a prefixed absolute path (e.g. latch:///welcome/welcome.pdf)
  • an absolute path without a prefix (e.g. /welcome/welcome.pdf)
  • a path relative to the root of the user's filesystem (e.g. welcome/welcome.pdf)

Note that the path specified must be valid and must point to a file, i.e. this command will throw an error if the argument is a remote directory.

latch mkdir

A Latch SDK user can now create remote directories directly from the command line.

Usage: latch mkdir [OPTIONS] REMOTE_DIRECTORY

  Creates a new remote directory

  Visit docs.latch.bio to learn more.

For example, $ latch mkdir welcome/example_dir will create a new directory called example_dir inside the user's welcome directory (assuming it exists). In general, the user can provide as input either

  • a prefixed absolute path (e.g. latch:///welcome/example_dir)
  • an absolute path without a prefix (e.g. /welcome/example_dir)
  • a path relative to the root of the user's filesystem (e.g. welcome/example_dir)

Note that all parent directories in the specified remote path must already exist. For example, something like $ latch mkdir welcome/doesnt_exist/example_dir will throw an error. Moreover, if a directory already exists at the specified remote path, this command will create an indexed version of the directory. For example, the sequence of commands

$ latch mkdir welcome/example_dir
$ latch mkdir welcome/example_dir

will create two different directories inside of welcome, one called example_dir and the other called example_dir 1.

latch touch

A Latch SDK user can now create remote files directly from the command line.

Usage: latch touch [OPTIONS] REMOTE_FILE

  Creates an empty text file.

  Visit docs.latch.bio to learn more.

For example, $ latch touch welcome/example.txt will create a new text file called example.txt in the user's welcome directory (assuming it exists). In general, the user can provide as input either

  • a prefixed absolute path (e.g. latch:///welcome/example.txt)
  • an absolute path without a prefix (e.g. /welcome/example.txt)
  • a path relative to the root of the user's filesystem (e.g. welcome/example.txt)

Much like mkdir, all parent directories in the specified remote path must already exist. For example, something like $ latch touch welcome/doesnt_exist/example.txt will throw an error. However, if a file already exists at the specified remote path, this command will overwrite the contents of that file instead of creating an indexed version.

latch rm

A Latch SDK user can now remove remote entities directly from the command line.

Usage: latch rm [OPTIONS] REMOTE_PATH

  Deletes a remote entity.

  Visit docs.latch.bio to learn more.

For example, $ latch rm welcome/welcome.pdf will delete the welcome.pdf file (assuming it exists) from the user's welcome directory. In general, the user can provide as input either

  • a prefixed absolute path (e.g. latch:///welcome/welcome.pdf)
  • an absolute path without a prefix (e.g. /welcome/welcome.pdf)
  • a path relative to the root of the user's filesystem (e.g. welcome/welcome.pdf)

The path may also point to a directory, in which case latch rm will behave like rm -r and deleting the directory as well as all of its contents. For safety, a user is not allowed to delete their root directory, and the command will throw an error if this is attempted. The command will also throw an error if the path being specified doesn't exist.

Other changes:

  • latch cp now supports copying directories in either direction