Feature Request: Command Line Streamline
I see in the readme how to use the open command to create a ram drive from the command line, but once the drive is created, TMPDisk remains running in the background.
Could we add a command line switch for closing the program once the drive is created?
Also, are all of the command line arguments documented anywhere? Or are the command line arguments in the readme the only ones available?
Also, it would be nice to be able to specify the size units on the command line like:
open -a /Applications/TmpDisk.app --args -name=TestDisk -size=64MB
open -a /Applications/TmpDisk.app --args -name=TestDisk -size=24GB
Or maybe
open -a /Applications/TmpDisk.app --args -name=TestDisk -size=64 -units=MB
open -a /Applications/TmpDisk.app --args -name=TestDisk -size=24 -units=GB
Hi @EasyG0ing1
I had only really added the cmd line prompt to make it easier to launch tmpdisk to manage the disks on startup (a feature request) but that was quickly superseded by the AutoCreate manager and run on login and pretty much just a legacy.
If your use case is just creating the TmpFS or Ram disks you can do it manually or create a simple bash shell around them instead of using tmpdisk since the extra features TmpDisk offers are only valid if TmpDisk is running.
sudo mount_tmpfs -s128M ~/.tmpfs/temp-128-mb-tmpfs
Or here's how to script up each of the variables for a plain ram disk
func createRamDiskTask(volume: TmpDiskVolume) -> String {
let dSize = UInt64(volume.size) * 2048
let filesystem: String = {
switch (volume.caseSensitive, volume.journaled) {
case (false, false):
return "HFS+" // Mac OS Extended
case (true, false):
return "HFSX" // Mac OS Extended (Case-sensitive)
case (false, true):
return "JHFS+" // Mac OS Extended (Journaled)
case (true, true):
return "JHFSX" // Mac OS Extended (Case-sensitive, Journaled)
}
}()
if volume.hidden {
return "d=$(hdiutil attach -nomount ram://\(dSize)) && diskutil eraseDisk \(filesystem) %noformat% $d && newfs_hfs -v \"\(volume.name)\" \"$(echo $d | tr -d ' ')s1\" && hdiutil attach -nomount $d && hdiutil attach -nobrowse \"$(echo $d | tr -d ' ')s1\""
} else {
return "diskutil eraseVolume \(filesystem) \"\(volume.name)\" `hdiutil attach -nomount ram://\(dSize)`"
}
}