1234567891011121314151617181920212223242526272829303132333435363738394041(*---------------------------------------------------------------------------
Copyright (c) 2020 The b0 programmers. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)openB0_stdopenResult.Syntaxletdelete~cleanconf=Log.if_error~use:Os.Exit.some_error@@letdel_dir=ifcleanthenSome(B0_driver.Conf.b0_dirconf)elseNone(* for now *)inmatchdel_dirwith|None->Log.stdout(funm->m"Nothing deleted for now!");OkOs.Exit.ok|Somedel_dir->let*_existed=Os.Path.delete~recurse:truedel_dirinOkOs.Exit.ok(* Command line interface *)openCmdlineropenCmdliner.Term.Syntaxletcmd=letdoc="Delete builds"inletdescr=`Blocks[`P"The $(cmd) command deletes the current variant and deployement \
builds and artefacts. The build cache is however kept intact.";`P"Use option $(b,--clean) option to get rid of the $(b,_b0) directory \
altogeter. This deletes all variants and deployments an most likely \
also gets rid of the build cache. See $(tool) $(b,cache) for finer \
control over build cache deletions."]inB0_tool_cli.cmd_with_driver_conf"delete"~doc~descr@@let+clean=letdoc="Delete the $(b,_b0) directory."inArg.(value&flag&info["c";"clean"]~doc)indelete~clean