mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-18 04:34:25 +00:00
Handle multiple disks on command-line for -i, -ls, -l, -ll.
This commit is contained in:
parent
626eeada53
commit
256ad44e6d
@ -100,7 +100,7 @@ CreateDirectoryMenuItem=Create Directory...
|
||||
CommandLineErrorMessage = Error: {0}
|
||||
CommandLineNoMatchMessage = {0}: No match.
|
||||
CommandLineStatus = {0} format; {1} bytes free; {2} bytes used.
|
||||
CommandLineHelp = AppleCommander command line options [{0}]:\n-i <imagename> display information about image.\n-ls <imagename> list brief directory of image.\n-l <imagename> list directory of image.\n-ll <imagename> list detailed directory of image.\n-e <imagename> <filename> export file from image to stdout.\n-g <imagename> <filename> get raw file from image to stdout.\n-p <imagename> <filename> <type> [[$|0x]<addr>] put stdin\n in filename on image, using file type and address [0x2000].\n-d <imagename> <filename> delete file from image.\n-k <imagename> <filename> lock file on image.\n-u <imagename> <filename> unlock file on image.\n-n <imagename> <volname> change volume name (ProDOS or Pascal).\n-cc65 <imagename> <filename> <type> put stdin with cc65 header\n in filename on image, using file type and address from header.\n-dos140 <imagename> create a 140K DOS 3.3 image.\n-pro140 <imagename> <volname> create a 140K ProDOS image.\n-pro800 <imagename> <volname> create an 800K ProDOS image.\n-pas140 <imagename> <volname> create a 140K Pascal image.\n-pas800 <imagename> <volname> create an 800K Pascal image.
|
||||
CommandLineHelp = AppleCommander command line options [{0}]:\n-i <imagename> [<imagename>] display information about image(s).\n-ls <imagename> [<imagename>] list brief directory of image(s).\n-l <imagename> [<imagename>] list directory of image(s).\n-ll <imagename> [<imagename>] list detailed directory of image(s).\n-e <imagename> <filename> export file from image to stdout.\n-g <imagename> <filename> get raw file from image to stdout.\n-p <imagename> <filename> <type> [[$|0x]<addr>] put stdin\n in filename on image, using file type and address [0x2000].\n-d <imagename> <filename> delete file from image.\n-k <imagename> <filename> lock file on image.\n-u <imagename> <filename> unlock file on image.\n-n <imagename> <volname> change volume name (ProDOS or Pascal).\n-cc65 <imagename> <filename> <type> put stdin with cc65 header\n in filename on image, using file type and address from header.\n-dos140 <imagename> create a 140K DOS 3.3 image.\n-pro140 <imagename> <volname> create a 140K ProDOS image.\n-pro800 <imagename> <volname> create an 800K ProDOS image.\n-pas140 <imagename> <volname> create a 140K Pascal image.\n-pas800 <imagename> <volname> create an 800K Pascal image.
|
||||
|
||||
# UserPreferences
|
||||
UserPreferencesComment = AppleCommander user preferences
|
||||
|
@ -49,26 +49,26 @@ import com.webcodepro.applecommander.util.TextBundle;
|
||||
* ac provides a command line interface to key AppleCommander functions.
|
||||
* Text similar to this is produced in response to the -h option.
|
||||
* <pre>
|
||||
* AppleCommander command line options [<i>version</i>]:
|
||||
* -i <imagename> display information about image.
|
||||
* -ls <imagename> list brief directory of image.
|
||||
* -l <imagename> list directory of image.
|
||||
* -ll <imagename> list detailed directory of image.
|
||||
* -e <imagename> <filename> export file from image to stdout.
|
||||
* -g <imagename> <filename> get raw file from image to stdout.
|
||||
* -p <imagename> <filename> <type> [[$|0x]<addr>] put stdin
|
||||
* CommandLineHelp = AppleCommander command line options [{0}]:
|
||||
* -i <imagename> [<imagename>] display information about image(s).
|
||||
* -ls <imagename> [<imagename>] list brief directory of image(s).
|
||||
* -l <imagename> [<imagename>] list directory of image(s).
|
||||
* -ll <imagename> [<imagename>] list detailed directory of image(s).
|
||||
* -e <imagename> <filename> export file from image to stdout.
|
||||
* -g <imagename> <filename> get raw file from image to stdout.
|
||||
* -p <imagename> <filename> <type> [[$|0x]<addr>] put stdin
|
||||
* in filename on image, using file type and address [0x2000].
|
||||
* -d <imagename> <filename> delete file from image.
|
||||
* -k <imagename> <filename> lock file on image.
|
||||
* -u <imagename> <filename> unlock file on image.
|
||||
* -n <imagename> <volname> change volume name (ProDOS or Pascal).
|
||||
* -cc65 <imagename> <filename> <type> put stdin with cc65 header
|
||||
* -d <imagename> <filename> delete file from image.
|
||||
* -k <imagename> <filename> lock file on image.
|
||||
* -u <imagename> <filename> unlock file on image.
|
||||
* -n <imagename> <volname> change volume name (ProDOS or Pascal).
|
||||
* -cc65 <imagename> <filename> <type> put stdin with cc65 header
|
||||
* in filename on image, using file type and address from header.
|
||||
* -dos140 <imagename> create a 140K DOS 3.3 image.
|
||||
* -pro140 <imagename> <volname> create a 140K ProDOS image.
|
||||
* -pro800 <imagename> <volname> create an 800K ProDOS image.
|
||||
* -pas140 <imagename> <volname> create a 140K Pascal image.
|
||||
* -pas800 <imagename> <volname> create an 800K Pascal image.
|
||||
* -dos140 <imagename> create a 140K DOS 3.3 image.
|
||||
* -pro140 <imagename> <volname> create a 140K ProDOS image.
|
||||
* -pro800 <imagename> <volname> create an 800K ProDOS image.
|
||||
* -pas140 <imagename> <volname> create a 140K Pascal image.
|
||||
* -pas800 <imagename> <volname> create an 800K Pascal image.
|
||||
* </pre>
|
||||
* @author John B. Matthews
|
||||
*/
|
||||
@ -80,13 +80,13 @@ public class ac {
|
||||
if (args.length == 0) {
|
||||
help();
|
||||
} else if ("-i".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
getDiskInfo(args[1]);
|
||||
getDiskInfo(args);
|
||||
} else if ("-ls".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
showDirectory(args[1], FormattedDisk.FILE_DISPLAY_STANDARD);
|
||||
showDirectory(args, FormattedDisk.FILE_DISPLAY_STANDARD);
|
||||
} else if ("-l".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
showDirectory(args[1], FormattedDisk.FILE_DISPLAY_NATIVE);
|
||||
showDirectory(args, FormattedDisk.FILE_DISPLAY_NATIVE);
|
||||
} else if ("-ll".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
showDirectory(args[1], FormattedDisk.FILE_DISPLAY_DETAIL);
|
||||
showDirectory(args, FormattedDisk.FILE_DISPLAY_DETAIL);
|
||||
} else if ("-e".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
getFile(args[1], args[2], true);
|
||||
} else if ("-g".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||
@ -126,7 +126,7 @@ public class ac {
|
||||
}
|
||||
|
||||
/**
|
||||
* Put <stdin> into the file named fileName on the disk named imageName;
|
||||
* Put <stdin> into the file named fileName on the disk named imageName;
|
||||
* Note: only volume level supported; input size unlimited.
|
||||
*/
|
||||
static void putFile(String imageName, String fileName, String fileType, String address)
|
||||
@ -152,7 +152,7 @@ public class ac {
|
||||
}
|
||||
|
||||
/**
|
||||
* Put <stdin> into the file named fileName on the disk named imageName;
|
||||
* Put <stdin> into the file named fileName on the disk named imageName;
|
||||
* Assume a cc65 style four-byte header with start address in bytes 0-1.
|
||||
*/
|
||||
static void putCC65(String imageName, String fileName, String fileType)
|
||||
@ -171,7 +171,7 @@ public class ac {
|
||||
static void deleteFile(String imageName, String fileName) throws IOException {
|
||||
Disk disk = new Disk(imageName);
|
||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||
for (int i=0; i<formattedDisks.length; i++) {
|
||||
for (int i = 0; i < formattedDisks.length; i++) {
|
||||
FormattedDisk formattedDisk = formattedDisks[i];
|
||||
List files = formattedDisk.getFiles();
|
||||
FileEntry entry = getEntry(files, fileName);
|
||||
@ -187,12 +187,12 @@ public class ac {
|
||||
|
||||
/**
|
||||
* Get the file named filename from the disk named imageName;
|
||||
* the file is filtered according to its type and sent to <stdout>.
|
||||
* the file is filtered according to its type and sent to <stdout>.
|
||||
*/
|
||||
static void getFile(String imageName, String fileName, boolean filter) throws IOException {
|
||||
Disk disk = new Disk(imageName);
|
||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||
for (int i=0; i<formattedDisks.length; i++) {
|
||||
for (int i = 0; i < formattedDisks.length; i++) {
|
||||
FormattedDisk formattedDisk = formattedDisks[i];
|
||||
List files = formattedDisk.getFiles();
|
||||
FileEntry entry = getEntry(files, fileName);
|
||||
@ -222,7 +222,7 @@ public class ac {
|
||||
static FileEntry getEntry(List files, String fileName) {
|
||||
FileEntry theEntry = null;
|
||||
if (files != null) {
|
||||
for (int i=0; i<files.size(); i++) {
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
FileEntry entry = (FileEntry) files.get(i);
|
||||
String entryName = entry.getFilename();
|
||||
if (!entry.isDeleted() &&
|
||||
@ -240,14 +240,14 @@ public class ac {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a directory listing of the disk named imageName.
|
||||
* Display a directory listing of each disk in args.
|
||||
*/
|
||||
static void showDirectory(String imageName, int display) throws IOException {
|
||||
Disk disk = new Disk(imageName);
|
||||
static void showDirectory(String[] args, int display) throws IOException {
|
||||
for (int d = 1; d < args.length; d++) {
|
||||
Disk disk = new Disk(args[d]);
|
||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||
for (int i=0; i<formattedDisks.length; i++) {
|
||||
for (int i = 0; i < formattedDisks.length; i++) {
|
||||
FormattedDisk formattedDisk = formattedDisks[i];
|
||||
System.out.println();
|
||||
System.out.println(formattedDisk.getDiskName());
|
||||
List files = formattedDisk.getFiles();
|
||||
if (files != null) {
|
||||
@ -263,6 +263,7 @@ public class ac {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive routine to display directory entries.
|
||||
@ -270,12 +271,12 @@ public class ac {
|
||||
* this really returns the first file with the given filename.
|
||||
*/
|
||||
static void showFiles(List files, String indent, int display) {
|
||||
for (int i=0; i<files.size(); i++) {
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
FileEntry entry = (FileEntry) files.get(i);
|
||||
if (!entry.isDeleted()) {
|
||||
List data = entry.getFileColumnData(display);
|
||||
System.out.print(indent);
|
||||
for (int d=0; d<data.size(); d++) {
|
||||
for (int d = 0; d < data.size(); d++) {
|
||||
System.out.print(data.get(d));
|
||||
System.out.print(" "); //$NON-NLS-1$
|
||||
}
|
||||
@ -289,12 +290,13 @@ public class ac {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display information about the given disk image.
|
||||
* Display information about each disk in args.
|
||||
*/
|
||||
static void getDiskInfo(String imageName) throws IOException {
|
||||
Disk disk = new Disk(imageName);
|
||||
static void getDiskInfo(String[] args) throws IOException {
|
||||
for (int d = 1; d < args.length; d++) {
|
||||
Disk disk = new Disk(args[d]);
|
||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||
for (int i=0; i<formattedDisks.length; i++) {
|
||||
for (int i = 0; i < formattedDisks.length; i++) {
|
||||
FormattedDisk formattedDisk = formattedDisks[i];
|
||||
Iterator iterator = formattedDisk.getDiskInformation().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@ -302,6 +304,8 @@ public class ac {
|
||||
System.out.println(diskinfo.getLabel() + ": " + diskinfo.getValue());
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user