diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-07-24 18:29:42 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-07-24 18:29:42 +0100 |
commit | 3385d7a1bf6afb8508ce334c6231c35cbe2fbae0 (patch) | |
tree | 8a5ff818c070404ec48205c9d47631969b4fd91e | |
parent | 3082681cc661011c8745936cc8c05e6fa84e0b98 (diff) | |
download | libguestfs-3385d7a1bf6afb8508ce334c6231c35cbe2fbae0.tar.gz libguestfs-3385d7a1bf6afb8508ce334c6231c35cbe2fbae0.tar.xz libguestfs-3385d7a1bf6afb8508ce334c6231c35cbe2fbae0.zip |
More ideas on a quick Perl one-liner syntax for TODO file.
-rw-r--r-- | TODO | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -244,3 +244,34 @@ any short Perl one-liner would be: You can see we're well beyond a single line just getting to the point of adding drives and mounting. + +First suggestion: + + $h = create ($filename, \"/dev/sda1\" => \"/\"); + + $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\"); + +To mount read-only, add C<ro =E<gt> 1> like this: + + $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1); + +which is equivalent to the following sequence of calls: + + $h = Sys::Guestfs->new (); + $h->set_autosync (1); + $h->add_drive_ro ($filename); + $h->launch (); + $h->wait_ready (); + $h->mount_ro (\"/dev/sda1\", \"/\"); + +Command-line form would be: + + perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");' + +That's not brief enough for one-liners, so we could have an extra +autogenerated module which creates a Sys::Guestfs handle singleton +(the handle is an implicit global variable as in guestfish), eg: + + perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");' + +How would editing files work? |