import { Maybe } from './common/types'; export declare enum Branch { Public = "public", Pretty = "p", Private = "private", PrivateLog = "privateLog", Version = "version" } export declare enum Kind { Directory = "directory", File = "file" } export declare type Path = string[]; export declare type DirectoryPath = { directory: Path; }; export declare type FilePath = { file: Path; }; /** * The primarily used type for paths. */ export declare type DistinctivePath = DirectoryPath | FilePath; /** * Utility function to create a `DirectoryPath` */ export declare function directory(...args: Path): DirectoryPath; /** * Utility function to create a `FilePath` */ export declare function file(...args: Path): FilePath; /** * Utility function to create a root `DirectoryPath` */ export declare function root(): DirectoryPath; /** * Transform a string into a `DistinctivePath`. * * Directories should have the format `path/to/dir/` and * files should have the format `path/to/file`. * * Leading forward slashes are removed too, so you can pass absolute paths. */ export declare function fromPosix(path: string): DistinctivePath; /** * Transform a `DistinctivePath` into a string. * * Directories will have the format `path/to/dir/` and * files will have the format `path/to/file`. */ export declare function toPosix(path: DistinctivePath, { absolute }?: { absolute: boolean; }): string; /** * Combine two `DistinctivePath`s. */ export declare function combine(a: DirectoryPath, b: DistinctivePath): DistinctivePath; /** * Is this `DistinctivePath` of the given `Branch`? */ export declare function isBranch(branch: Branch, path: DistinctivePath): boolean; /** * Is this `DistinctivePath` a directory? */ export declare function isDirectory(path: DistinctivePath): path is DirectoryPath; /** * Is this `DistinctivePath` a file? */ export declare function isFile(path: DistinctivePath): path is FilePath; /** * Is this `DirectoryPath` a root directory? */ export declare function isRootDirectory(path: DirectoryPath): boolean; /** * Check if two `DistinctivePath` have the same `Branch`. */ export declare function isSameBranch(a: DistinctivePath, b: DistinctivePath): boolean; /** * Check if two `DistinctivePath` are of the same kind. */ export declare function isSameKind(a: DistinctivePath, b: DistinctivePath): boolean; /** * What `Kind` of path are we dealing with? */ export declare function kind(path: DistinctivePath): Kind; /** * Map a `DistinctivePath`. */ export declare function map(fn: (p: Path) => Path, path: DistinctivePath): DistinctivePath; /** * Get the parent directory of a `DistinctivePath`. */ export declare function parent(path: DistinctivePath): Maybe; /** * Remove the `Branch` of a `DistinctivePath` (ie. the top-level directory) */ export declare function removeBranch(path: DistinctivePath): DistinctivePath; /** * Unwrap a `DistinctivePath`. */ export declare function unwrap(path: DistinctivePath): Path; /** * Render a raw `Path` to a string for logging purposes. */ export declare function log(path: Path): string;