The current definition of the set-attr command is:
set-attr [options] <ext-archive> <file-in-archive> [attrs...]
The optional attrs argument is a space-separated list of attributes, e.g. type=BIN aux=0x2000. If the attribute list is omitted, the command behaves like get-attr instead (there is no get-attr command). There are a couple of problems with this:
The pattern diverges from commands like UNIX chmod, which take a list of filenames.
The pattern diverges from other cp2 commands, like export [options] <ext-archive> <export-spec> [file-in-archive...], which put a "specification" between the ext-archive argument and the filename list.
Getting attributes with set-attr feels a little weird.
Furthermore, the current argument order prevents the command from allowing the user to mark a big pile of files read-only with a statement like cp2 set-attr mydisk.po locked file1 file2 file3.
Four changes should be made:
The order of arguments should be changed, so that the attributes come before the filename.
The attributes should be a comma-separated list, rather than space-separated. This is for convenience when setting multiple attributes.
The command should take multiple filenames, with the usual wildcard support.
The no-attribute form of the command no longer makes sense, so we need a get-attr command.
Switching from space-separated to comma-separated shouldn't cause problems. The only opportunity for commas to appear naturally is in the Mac creator/file type strings, but that should be rare, and those allow hex digits to be provided.
This should improve the function of the command, and allow the behavior requested in issue #27.
The command should only descend into subdirectories if --recurse is given on the command line. It's reasonable to change the attributes of a directory.
The get-attr command is fundamentally a single-file command. The argument order should be the same as the old set-attr, so that we can take an attribute name as an optional argument:
get-attr [options] <ext-archive> <file-in-archive> [attr]
The idea is that get-attr file dumps the full list of attributes as human-readable name/value pairs, while e.g. get-attr file type just prints the value in a machine-readable sort of way. This could be useful for shell scripts.
Sample of current output:
Attributes for 'Pics.3200/ROSE.3200':
File Type : PNT $c0
Aux Type : $8005
HFS Type : '␀␀␀␀' $00000000
HFS Creator : '␀␀␀␀' $00000000
Access : $e3 [dnbwr]
Create Date : 24-Sep-1991 01:12:00
Mod Date : 24-Sep-1991 01:12:00
Comment : (none)
The current definition of the
set-attr
command is:set-attr [options] <ext-archive> <file-in-archive> [attrs...]
The optional
attrs
argument is a space-separated list of attributes, e.g.type=BIN aux=0x2000
. If the attribute list is omitted, the command behaves likeget-attr
instead (there is noget-attr
command). There are a couple of problems with this:chmod
, which take a list of filenames.export [options] <ext-archive> <export-spec> [file-in-archive...]
, which put a "specification" between the ext-archive argument and the filename list.set-attr
feels a little weird.Furthermore, the current argument order prevents the command from allowing the user to mark a big pile of files read-only with a statement like
cp2 set-attr mydisk.po locked file1 file2 file3
.Four changes should be made:
get-attr
command.Switching from space-separated to comma-separated shouldn't cause problems. The only opportunity for commas to appear naturally is in the Mac creator/file type strings, but that should be rare, and those allow hex digits to be provided.
This should improve the function of the command, and allow the behavior requested in issue #27.
The command should only descend into subdirectories if
--recurse
is given on the command line. It's reasonable to change the attributes of a directory.The
get-attr
command is fundamentally a single-file command. The argument order should be the same as the oldset-attr
, so that we can take an attribute name as an optional argument:get-attr [options] <ext-archive> <file-in-archive> [attr]
The idea is that
get-attr file
dumps the full list of attributes as human-readable name/value pairs, while e.g.get-attr file type
just prints the value in a machine-readable sort of way. This could be useful for shell scripts.Sample of current output: