X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=python%2Fguestfs.py;h=e62a527168d8780cc8ab2e49c536ed6f8af02d49;hp=23aef9c280a0cb62fc05e5f2e456cb5829d04d82;hb=e492608f2f3809a824cb70ee03ff305964b69dd7;hpb=da947eadcfa1367c2d634667068db813a87a6dd1 diff --git a/python/guestfs.py b/python/guestfs.py index 23aef9c..e62a527 100644 --- a/python/guestfs.py +++ b/python/guestfs.py @@ -1478,7 +1478,7 @@ class GuestFS: """ return libguestfsmod.pvresize (self._o, device) - def sfdisk_N (self, device, n, cyls, heads, sectors, line): + def sfdisk_N (self, device, partnum, cyls, heads, sectors, line): u"""This runs sfdisk(8) option to modify just the single partition "n" (note: "n" counts from 1). @@ -1488,7 +1488,7 @@ class GuestFS: This command is dangerous. Without careful use you can easily destroy all your data. """ - return libguestfsmod.sfdisk_N (self._o, device, n, cyls, heads, sectors, line) + return libguestfsmod.sfdisk_N (self._o, device, partnum, cyls, heads, sectors, line) def sfdisk_l (self, device): u"""This displays the partition table on "device", in the @@ -1727,3 +1727,116 @@ class GuestFS: """ return libguestfsmod.mkdtemp (self._o, template) + def wc_l (self, path): + u"""This command counts the lines in a file, using the "wc + -l" external command. + """ + return libguestfsmod.wc_l (self._o, path) + + def wc_w (self, path): + u"""This command counts the words in a file, using the "wc + -w" external command. + """ + return libguestfsmod.wc_w (self._o, path) + + def wc_c (self, path): + u"""This command counts the characters in a file, using the + "wc -c" external command. + """ + return libguestfsmod.wc_c (self._o, path) + + def head (self, path): + u"""This command returns up to the first 10 lines of a file + as a list of strings. + + This function returns a list of strings. + + Because of the message protocol, there is a transfer + limit of somewhere between 2MB and 4MB. To transfer + large files you should use FTP. + """ + return libguestfsmod.head (self._o, path) + + def head_n (self, nrlines, path): + u"""If the parameter "nrlines" is a positive number, this + returns the first "nrlines" lines of the file "path". + + If the parameter "nrlines" is a negative number, this + returns lines from the file "path", excluding the last + "nrlines" lines. + + If the parameter "nrlines" is zero, this returns an + empty list. + + This function returns a list of strings. + + Because of the message protocol, there is a transfer + limit of somewhere between 2MB and 4MB. To transfer + large files you should use FTP. + """ + return libguestfsmod.head_n (self._o, nrlines, path) + + def tail (self, path): + u"""This command returns up to the last 10 lines of a file + as a list of strings. + + This function returns a list of strings. + + Because of the message protocol, there is a transfer + limit of somewhere between 2MB and 4MB. To transfer + large files you should use FTP. + """ + return libguestfsmod.tail (self._o, path) + + def tail_n (self, nrlines, path): + u"""If the parameter "nrlines" is a positive number, this + returns the last "nrlines" lines of the file "path". + + If the parameter "nrlines" is a negative number, this + returns lines from the file "path", starting with the + "-nrlines"th line. + + If the parameter "nrlines" is zero, this returns an + empty list. + + This function returns a list of strings. + + Because of the message protocol, there is a transfer + limit of somewhere between 2MB and 4MB. To transfer + large files you should use FTP. + """ + return libguestfsmod.tail_n (self._o, nrlines, path) + + def df (self): + u"""This command runs the "df" command to report disk space + used. + + This command is mostly useful for interactive sessions. + It is *not* intended that you try to parse the output + string. Use "statvfs" from programs. + """ + return libguestfsmod.df (self._o) + + def df_h (self): + u"""This command runs the "df -h" command to report disk + space used in human-readable format. + + This command is mostly useful for interactive sessions. + It is *not* intended that you try to parse the output + string. Use "statvfs" from programs. + """ + return libguestfsmod.df_h (self._o) + + def du (self, path): + u"""This command runs the "du -s" command to estimate file + space usage for "path". + + "path" can be a file or a directory. If "path" is a + directory then the estimate includes the contents of the + directory and all subdirectories (recursively). + + The result is the estimated size in *kilobytes* (ie. + units of 1024 bytes). + """ + return libguestfsmod.du (self._o, path) +