aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index f933f6f..af20f71 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,8 +12,11 @@ use utils::DEFAULT_DEPOT_FILE_NAME;
12 12
13#[derive(Parser, Debug)] 13#[derive(Parser, Debug)]
14pub struct Flags { 14pub struct Flags {
15 /// Path to the depot file, default to `.depot`.
15 #[clap(long)] 16 #[clap(long)]
16 depot: Option<PathBuf>, 17 depot: Option<PathBuf>,
18
19 /// Path to the install base, defaults to the home directory.
17 #[clap(long)] 20 #[clap(long)]
18 install_base: Option<PathBuf>, 21 install_base: Option<PathBuf>,
19} 22}
@@ -75,6 +78,10 @@ fn main() -> anyhow::Result<()> {
75 } 78 }
76} 79}
77 80
81/// Creates an empty depot file if one doesnt already exist.
82///
83/// By default this will create the file in the current directory
84/// but the `path` option can be used to change this path.
78#[derive(Parser, Debug)] 85#[derive(Parser, Debug)]
79struct InitArgs { 86struct InitArgs {
80 path: Option<PathBuf>, 87 path: Option<PathBuf>,
@@ -99,6 +106,11 @@ fn command_init(_global_flags: Flags, args: InitArgs) -> anyhow::Result<()> {
99 Ok(()) 106 Ok(())
100} 107}
101 108
109/// Creates links
110///
111/// If a link is created for a file that already had a link then the old link will be overwritten.
112/// By default creating a link to a directory will recursively link all files under that
113/// directory, to actually link a directory use the --directory flag.
102#[derive(Parser, Debug)] 114#[derive(Parser, Debug)]
103struct LinkArgs { 115struct LinkArgs {
104 #[clap(long)] 116 #[clap(long)]
@@ -125,6 +137,11 @@ fn command_link(global_flags: Flags, args: LinkArgs) -> anyhow::Result<()> {
125 Ok(()) 137 Ok(())
126} 138}
127 139
140/// Unlinks files/directories.
141///
142/// This will recursively remove links. If a path is a directory then it will remove all links
143/// recursively.
144/// The links are not uninstall by default, see the --uninstall parameter.
128#[derive(Parser, Debug)] 145#[derive(Parser, Debug)]
129struct UnlinkArgs { 146struct UnlinkArgs {
130 #[clap(long)] 147 #[clap(long)]
@@ -140,6 +157,10 @@ fn command_unlink(global_flags: Flags, args: UnlinkArgs) -> anyhow::Result<()> {
140 Ok(()) 157 Ok(())
141} 158}
142 159
160/// Install links. (Creates symlinks).
161///
162/// Installing a link will create the necessary directories.
163/// If a file or directory already exists at the location a link would be installed this command will fail.
143#[derive(Parser, Debug)] 164#[derive(Parser, Debug)]
144struct InstallArgs { 165struct InstallArgs {
145 #[clap(long)] 166 #[clap(long)]
@@ -154,6 +175,11 @@ fn command_install(global_flags: Flags, args: InstallArgs) -> anyhow::Result<()>
154 Ok(()) 175 Ok(())
155} 176}
156 177
178/// Uninstalls links. (Removes symlinks).
179///
180/// Uninstalling a link for a file that didn't have a link will do nothing.
181/// Uninstalling a directory will recursively uninstall all files under it.
182/// Symlinks are only deleted if they were pointing to the correct file.
157#[derive(Parser, Debug)] 183#[derive(Parser, Debug)]
158struct UninstallArgs { 184struct UninstallArgs {
159 paths: Vec<PathBuf>, 185 paths: Vec<PathBuf>,
@@ -165,6 +191,7 @@ fn command_uninstall(global_flags: Flags, args: UninstallArgs) -> anyhow::Result
165 Ok(()) 191 Ok(())
166} 192}
167 193
194/// Moves files/directories and updates links.
168#[derive(Parser, Debug)] 195#[derive(Parser, Debug)]
169struct MvArgs { 196struct MvArgs {
170 paths: Vec<PathBuf>, 197 paths: Vec<PathBuf>,
@@ -183,6 +210,7 @@ fn command_mv(global_flags: Flags, args: MvArgs) -> anyhow::Result<()> {
183 Ok(()) 210 Ok(())
184} 211}
185 212
213/// Shows information about links
186#[derive(Parser, Debug)] 214#[derive(Parser, Debug)]
187struct StatusArgs {} 215struct StatusArgs {}
188 216