package ops
- Alphabetic
- By Inheritance
- ops
- RelPathStuff
- Extensions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
sealed
trait
BasePath extends AnyRef
A path which is either an absolute Path, a relative RelPath, or a ResourcePath with shared APIs and implementations.
A path which is either an absolute Path, a relative RelPath, or a ResourcePath with shared APIs and implementations.
Most of the filesystem-independent path-manipulation logic that lets you splice paths together or navigate in and out of paths lives in this interface
- trait BasePathImpl extends BasePath
-
class
Bytes extends AnyRef
Trivial wrapper around
Array[Byte]
with sane equality and useful toString -
class
Callable1[T1, R] extends (T1) ⇒ R
Provides
a.! b
as an alternative to thea(b)
syntax for calling a function with one argument -
class
Callable2[T1, T2, R] extends (T1, T2) ⇒ R
Provides
a! b
as an alternative to the(a(b, _)
syntax for partially applying a function with two arguments -
case class
Command[T](cmd: Vector[String], envArgs: Map[String, String], execute: (Path, Command[_]) ⇒ T) extends Dynamic with Product with Serializable
A staged sub-process command that has yet to be executed.
-
case class
CommandResult(exitCode: Int, chunks: Seq[Either[Bytes, Bytes]]) extends Product with Serializable
Contains the accumulated output for the invocation of a subprocess command.
Contains the accumulated output for the invocation of a subprocess command.
Apart from the exit code, the primary data-structure is a sequence of byte chunks, tagged with Left for stdout and Right for stderr. This is interleaved roughly in the order it was emitted by the subprocess, and reflects what a user would have see if the subprocess was run manually.
Derived from that, is the aggregate
out
anderr
StreamValues, wrapping stdout/stderr respectively, and providing convenient access to the aggregate output of each stream, as bytes or strings or lines. - trait CopyMove extends (Path, Path) ⇒ Unit
- trait Extensions extends AnyRef
-
implicit
class
iterShow[T] extends AnyRef
- Definition Classes
- Extensions
-
sealed
trait
FilePath extends BasePath
Represents a value that is either an absolute Path or a relative RelPath, and can be constructed from a java.nio.file.Path or java.io.File
-
sealed
trait
FileType extends AnyRef
Simple enum with the possible filesystem objects a path can resolve to
-
class
FilterMapExt[+T, Repr] extends AnyRef
Extends collections to give short aliases for the commonly used operations, so we can make it easy to use from the command line.
-
class
FilterMapExt2[+T] extends AnyRef
Extends collections to give short aliases for the commonly used operations, so we can make it easy to use from the command line.
-
class
FilterMapExtGen[+T] extends AnyRef
Extends collections to give short aliases for the commonly used operations, so we can make it easy to use from the command line.
- trait ImplicitOp[V] extends (Path) ⇒ V
- case class InteractiveShelloutException() extends Exception with Product with Serializable
-
case class
LsSeq(base: Path, listed: RelPath*) extends Seq[Path] with Product with Serializable
A specialized Seq[Path] used to provide better a better pretty-printed experience
-
class
Path extends FilePath with BasePathImpl with Readable
An absolute path on the filesystem.
An absolute path on the filesystem. Note that the path is normalized and cannot contain any empty
""
,"."
or".."
segments - sealed trait PathConvertible[T] extends AnyRef
-
class
PermSet extends Set[PosixFilePermission]
A set of permissions
-
class
Pipeable[T] extends AnyRef
Lets you pipe values through functions
-
trait
Readable extends AnyRef
A path that can be read from, either a Path or a ResourcePath.
A path that can be read from, either a Path or a ResourcePath. Encapsulates the logic of how to read from it in various ways.
-
class
RegexContext extends AnyRef
Lets you pattern match strings with interpolated glob-variables
-
class
RelPath extends FilePath with BasePathImpl
An absolute path on the filesystem.
An absolute path on the filesystem. Note that the path is normalized and cannot contain any empty or ".". Parent ".." segments can only occur at the left-end of the path, and are collapsed into a single number ups.
- trait RelPathStuff extends AnyRef
-
implicit
class
RelPathStart extends AnyRef
- Definition Classes
- RelPathStuff
-
implicit
class
RelPathStart2 extends AnyRef
- Definition Classes
- RelPathStuff
-
case class
ResourceNotFoundException(path: ResourcePath) extends Exception with Product with Serializable
Thrown when you try to read from a resource that doesn't exist.
-
class
ResourcePath extends BasePathImpl with Readable
Classloaders are tricky: http://stackoverflow.com/questions/12292926
-
sealed
trait
ResourceRoot extends AnyRef
Represents a possible root where classpath resources can be loaded from; either a ResourceRoot.ClassLoader or a ResourceRoot.Class.
Represents a possible root where classpath resources can be loaded from; either a ResourceRoot.ClassLoader or a ResourceRoot.Class. Resources loaded from classloaders are always loaded via their absolute path, while resources loaded via classes are always loaded relatively.
-
case class
Shellable(s: Seq[String]) extends Product with Serializable
An implicit wrapper defining the things that can be "interpolated" directly into a subprocess call.
-
case class
ShelloutException(result: CommandResult) extends Exception with Product with Serializable
Thrown when a shellout command results in a non-zero exit code.
Thrown when a shellout command results in a non-zero exit code.
Doesn't contain any additional information apart from the CommandResult that is normally returned, but ensures that failures in subprocesses happen loudly and won't get ignored unless intentionally caught
-
case class
StreamValue(chunks: Seq[Bytes]) extends Product with Serializable
Encapsulates one of the output streams from a subprocess and provides convenience methods for accessing it in a variety of forms
-
trait
StreamableOp1[T1, R, C <: Seq[R]] extends (T1) ⇒ C
An Callable1 that returns a Seq[R], but can also do so lazily (Iterator[R]) via
op.iter! arg
.An Callable1 that returns a Seq[R], but can also do so lazily (Iterator[R]) via
op.iter! arg
. You can then use the iterator however you wish -
case class
kill(signal: Int)(implicit wd: Path) extends (Int) ⇒ CommandResult with Product with Serializable
Kills the given process with the given signal, e.g.
Kills the given process with the given signal, e.g.
kill(9)! pid
-
case class
stat(name: String, size: Long, mtime: FileTime, owner: UserPrincipal, permissions: PermSet, fileType: FileType) extends Product with Serializable
The result from doing an system
stat
on a particular path.The result from doing an system
stat
on a particular path.Created via
stat! filePath
.If you want more information, use
stat.full
Value Members
-
val
%: Command[Unit]
Used to spawn a subprocess interactively; any output gets printed to the console and any input gets requested from the current console.
Used to spawn a subprocess interactively; any output gets printed to the console and any input gets requested from the current console. Can be used to run interactive subprocesses like
%vim
,%python
,%ssh "www.google.com"
or%sbt
. -
val
%%: Command[CommandResult]
Spawns a subprocess non-interactively, waiting for it to complete and collecting all output into a CommandResult which exposes it in a convenient form.
Spawns a subprocess non-interactively, waiting for it to complete and collecting all output into a CommandResult which exposes it in a convenient form. Call via
%%('whoami).out.trim
or%%('git, 'commit, "-am", "Hello!").exitCode
-
implicit
def
Callable1Implicit[T1, R](f: (T1) ⇒ R): Callable1[T1, R]
- Definition Classes
- Extensions
-
implicit
def
FilterMapArraysImplicit[T](a: Array[T]): FilterMapExt[T, Array[T]]
Lets you call FilterMapExt aliases on Arrays too
Lets you call FilterMapExt aliases on Arrays too
- Definition Classes
- Extensions
-
implicit
def
FilterMapExtImplicit[T, Repr](i: TraversableLike[T, Repr]): FilterMapExt[T, Repr]
- Definition Classes
- Extensions
-
implicit
def
FilterMapGeneratorsImplicit[T](a: Generator[T]): FilterMapExtGen[T]
- Definition Classes
- Extensions
-
implicit
def
FilterMapIteratorsImplicit[T](a: Iterator[T]): FilterMapExt2[T]
- Definition Classes
- Extensions
-
implicit
def
PipeableImplicit[T](t: T): Pipeable[T]
- Definition Classes
- Extensions
-
implicit
def
RegexContextMaker(s: StringContext): RegexContext
- Definition Classes
- Extensions
-
implicit
def
SeqFactoryFunc[T, CC[X] <: Seq[X] with GenericTraversableTemplate[X, CC]](s: SeqFactory[CC]): (Seq[T]) ⇒ CC[T]
Allows you to pipe sequences into other sequences to convert them, e.g.
Allows you to pipe sequences into other sequences to convert them, e.g. Seq(1, 2, 3) |> Vector
- Definition Classes
- Extensions
-
val
empty: RelPath
- Definition Classes
- RelPathStuff
-
implicit
def
fileData(p: Path): full
Lets you treat any path as a file, letting you access any property you'd normally access through stat-ing it by stat-ing the file for you when necessary.
-
val
home: Path
The user's home directory
- implicit val postfixOps: postfixOps
-
lazy val
pwd: Path
The current working directory for this process.
- def resource(implicit resRoot: ResourceRoot = ...): ResourcePath
-
val
root: Path
The root of the filesystem
-
val
up: RelPath
- Definition Classes
- RelPathStuff
-
object
/
Extractor to let you easily pattern match on ops.Paths.
Extractor to let you easily pattern match on ops.Paths. Lets you do
@ val base/segment/filename = pwd base: Path = Path(Vector("Users", "haoyi", "Dropbox (Personal)")) segment: String = "Workspace" filename: String = "Ammonite"
To break apart a path and extract various pieces of it.
- object BasePath
- object Extensions extends Extensions
- object FilePath
- object FileType
-
object
ImplicitWd
If you want to call subprocesses using % or %% and don't care what working directory they use, import this via
- object Internals
- object Path
- object PathConvertible
- object PathError
- object PermSet
- object Readable
- object RegexContext
- object RelPath extends RelPathStuff
- object ResourcePath
- object ResourceRoot
- object Shellable extends Serializable
-
object
Shellout
Internal utilities to support spawning subprocesses
-
object
cp extends (Path, Path) ⇒ Unit with CopyMove
Copies a file or folder from one place to another.
Copies a file or folder from one place to another. Creates any necessary directories, and copies folders recursively.
-
object
exists extends (Path) ⇒ Boolean
Checks if a file or folder exists at the given path.
-
object
ln extends (Path, Path) ⇒ Unit
Creates a hardlink between two paths.
Creates a hardlink between two paths. Use
.s(src, dest)
to create a symlink -
object
ls extends StreamableOp1[Path, Path, LsSeq] with ImplicitOp[LsSeq]
List the files and folders in a directory.
List the files and folders in a directory. Can be called with
.iter
to return an iterator, or.rec
to recursively list everything in subdirectories..rec
is a ls.Walker which means that apart from straight-forwardly listing everything, you can pass in askip
predicate to cause your recursion to skip certain files or folders. -
object
mkdir extends (Path) ⇒ Unit
Makes directories up to the specified path.
Makes directories up to the specified path. Equivalent to
mkdir -p
in bash -
object
mv extends (Path, Path) ⇒ Unit with Mover with CopyMove
Moves a file or folder from one place to another.
Moves a file or folder from one place to another.
Creates any necessary directories
-
object
read extends (Readable) ⇒ String
Reads a file into memory, either as a String, as (read.lines(...): Seq[String]), or as (read.bytes(...): Array[Byte]).
-
object
rm extends (Path) ⇒ Unit
Roughly equivalent to bash's
rm -rf
.Roughly equivalent to bash's
rm -rf
. Deletes any files or folders in the target path, or does nothing if there aren't any - object stat extends (Path) ⇒ stat with Serializable
-
object
tmp
Alias for
java.nio.file.Files.createTempFile
andjava.io.File.deleteOnExit
.Alias for
java.nio.file.Files.createTempFile
andjava.io.File.deleteOnExit
. Pass indeleteOnExit = false
if you want the temp file to stick around. -
object
write extends (Path, Writable) ⇒ Unit
Write some data to a file.
Write some data to a file. This can be a String, an Array[Byte], or a Seq[String] which is treated as consecutive lines. By default, this fails if a file already exists at the target location. Use write.over or write.append if you want to over-write it or add to what's already there.