User Command REMOVEVERSIONS (Dyalog)
Overview
REMOVEVERSIONS is a command used to remove versions of scripts.
REMOVEVERSIONS is one of the SALT commands made into a user command.
Assumptions
When versionning is enabled for a SALT script the number of files can build up and may need to be reduced. The SALT files that are versionned all include a number in the filename that represents the version of the script.
There are several ways to do this and using the operating system tools, either manually or programmatically, to delete them will do.
Implementation
The command accepts an argument which is a path to a script. The paths may be absolute or relative. In the latter case the 'workdir' settings (see UserCommands/SALT/Settings for details) will be used to find the item.
It also requires that we specify the version(s) to delete.
REMOVEVERSIONS accepts a series of switches to alter its functionality:
-version takes a value which is the description of the versions to delete.
If it is a single number it represents the specific version to delete.
If it is a pair of numbers or 2 numbers separated by a dash it represents the range of versions to delete (e.g. 3-7).
If it is a single number preceded by a relational function (e.g. >12) then the versions that fit that relation are deleted
-collapse will prevent deleting the highest versionned file and renumber it so there is no gap left.
For ex, if there are 20 versions numbered 1 to 20 and the -version switch is equal to >10 and -collapse has been set then versions 11 to 19 will be deleted and version 20 will be renamed to 11.
-all is a shortcut to specifying -version= ≥0 -collapse
Either -version or -all must be set but not both.
Samples
]REMOVEVERSIONS \my\own\function -version= 4-7 ]REMOVEVERSIONS \my\own\function -version=>12 -collapse ]REMOVEVERSIONS my\script -all
Version
This script is part of the Dyalog product. For that reason this page is immutable.
The script is version 1.0 from 2007
Author: DanBaronet
APL Wiki