Commit d06a0632 by willmcgugan@gmail.com

Docs

parent 8de30fd9
.. _commands:
Command Line Applications Command Line Applications
========================= =========================
...@@ -17,8 +19,8 @@ You can also 'point' the command line applications at an opener to add it to a l ...@@ -17,8 +19,8 @@ You can also 'point' the command line applications at an opener to add it to a l
For example, the following uses a custom opener to list the contents of a directory served with the 'myfs' protocol:: For example, the following uses a custom opener to list the contents of a directory served with the 'myfs' protocol::
fsls --fs mypackage.mymodule.myfs.MyFSOpener myfs://127.0.0.1 fsls --fs mypackage.mymodule.myfs.MyFSOpener myfs://127.0.0.1
Listing Supported Filesystems Listing Supported Filesystems
----------------------------- -----------------------------
...@@ -32,7 +34,7 @@ fsls ...@@ -32,7 +34,7 @@ fsls
Lists the contents of a directory, similar to the ``ls`` command, e.g.:: Lists the contents of a directory, similar to the ``ls`` command, e.g.::
fsls fsls
fsls ../ fsls ../
fsls ftp://example.org/pub fsls ftp://example.org/pub
fsls zip://photos.zip fsls zip://photos.zip
...@@ -55,7 +57,7 @@ Writes a file to stdout, e.g:: ...@@ -55,7 +57,7 @@ Writes a file to stdout, e.g::
fscat ~/.bashrc fscat ~/.bashrc
fscat http://www.willmcgugan.com fscat http://www.willmcgugan.com
fscat ftp://ftp.mozilla.org/pub/README fscat ftp://ftp.mozilla.org/pub/README
fsinfo fsinfo
------ ------
...@@ -63,7 +65,7 @@ Displays information regarding a file / directory, e.g:: ...@@ -63,7 +65,7 @@ Displays information regarding a file / directory, e.g::
fsinfo C:\autoexec.bat fsinfo C:\autoexec.bat
fsinfo ftp://ftp.mozilla.org/pub/README fsinfo ftp://ftp.mozilla.org/pub/README
fsmv fsmv
---- ----
...@@ -71,7 +73,7 @@ Moves a file from one location to another, e.g:: ...@@ -71,7 +73,7 @@ Moves a file from one location to another, e.g::
fsmv foo bar fsmv foo bar
fsmv *.jpg zip://photos.zip fsmv *.jpg zip://photos.zip
fsmkdir fsmkdir
------- -------
...@@ -100,11 +102,11 @@ Removes (deletes) a file from a filesystem, e.g:: ...@@ -100,11 +102,11 @@ Removes (deletes) a file from a filesystem, e.g::
fsserve fsserve
------- -------
Serves the contents of a filesystem over a network with one of a number of methods; HTTP, RPC or SFTP, e.g:: Serves the contents of a filesystem over a network with one of a number of methods; HTTP, RPC or SFTP, e.g::
fsserve fsserve
fsserve --type rpc fsserve --type rpc
fsserve --type http zip://photos.zip fsserve --type http zip://photos.zip
fsmount fsmount
------- -------
......
...@@ -6,7 +6,7 @@ PyFilesystem is a Python-only module and can be installed from source or with `p ...@@ -6,7 +6,7 @@ PyFilesystem is a Python-only module and can be installed from source or with `p
Installing Installing
---------- ----------
To install with pip, use the following To install with pip, use the following::
pip install fs pip install fs
...@@ -26,6 +26,16 @@ Whichever method you use, you should now have the `fs` module on your path (vers ...@@ -26,6 +26,16 @@ Whichever method you use, you should now have the `fs` module on your path (vers
>>> fs.__version__ >>> fs.__version__
'0.5.0' '0.5.0'
You should also have the command line applications installed. If you enter the following in the command line, you should see a tree display of the current working directory::
fstree -l 2
Because the command line utilities use PyFilesystem, they also work with any of the supported filesystems. For example::
fstree ftp://ftp.mozilla.org -l 2
See :doc:`commands` for more information on the command line applications.
Prerequisites Prerequisites
------------- -------------
......
...@@ -10,7 +10,15 @@ Even if you only want to work with the local filesystem, PyFilesystem simplifies ...@@ -10,7 +10,15 @@ Even if you only want to work with the local filesystem, PyFilesystem simplifies
About PyFilesystem About PyFilesystem
------------------ ------------------
PyFilesystem was initially created by Will McGugan (http://www.willmcgugan.com) and is now a joint effort with Ryan Kelly (http://www.rfk.id.au/). PyFilesystem was initially created by Will McGugan and is now a joint effort from the following contributors:
- Will McGugan (http://www.willmcgugan.com)
- Ryan Kelly (http://www.rfx.id.au)
- Andrew Scheller
- Ben Timby
And many others who have contributed bug reports and patches.
Need Help? Need Help?
......
...@@ -3,7 +3,7 @@ Release Notes ...@@ -3,7 +3,7 @@ Release Notes
PyFilesystem has reached a point where the interface is relatively stable. The were some backwards incompatibilities introduced with version 0.5.0, due to Python 3 support. PyFilesystem has reached a point where the interface is relatively stable. The were some backwards incompatibilities introduced with version 0.5.0, due to Python 3 support.
Changes from 0.5.0 Changes from 0.4.0
------------------ ------------------
Python 3.X support was added. The interface has remained much the same, but the ``open`` method now works like Python 3's builtin, which handles text encoding more elegantly. i.e. if you open a file in text mode, you get a stream that reads or writes unicode rather than binary strings. Python 3.X support was added. The interface has remained much the same, but the ``open`` method now works like Python 3's builtin, which handles text encoding more elegantly. i.e. if you open a file in text mode, you get a stream that reads or writes unicode rather than binary strings.
...@@ -14,7 +14,7 @@ The new signature to the ``open`` method (and ``safeopen``) is as follows:: ...@@ -14,7 +14,7 @@ The new signature to the ``open`` method (and ``safeopen``) is as follows::
In order to keep the same signature across both Python 2 and 3, PyFilesystems uses the ``io`` module from the standard library. Unfortunately this is only available from Python 2.6 onwards, so Python 2.5 support has been dropped. If you need Python 2.5 support, consider sticking to PyFilesystem 0.4.0. In order to keep the same signature across both Python 2 and 3, PyFilesystems uses the ``io`` module from the standard library. Unfortunately this is only available from Python 2.6 onwards, so Python 2.5 support has been dropped. If you need Python 2.5 support, consider sticking to PyFilesystem 0.4.0.
By default the new ``open`` method now returns a unicode text stream, whereas 0.4.0 returned a binary file-like object. If you have code that runs on 0.4.0, you will probably want to either modify your code to work with unicode or explicitly open files in binary mode. The later is as simple as changing the mode from "r" to "rb" (or "w" to "wb"), but if you were working with unicode, the new text streams will likely save you a few lines of code. By default the new ``open`` method now returns a unicode text stream, whereas 0.4.0 returned a binary file-like object. If you have code that runs on 0.4.0, you will probably want to either modify your code to work with unicode or explicitly open files in binary mode. The latter is as simple as changing the mode from "r" to "rb" (or "w" to "wb"), but if you were working with unicode, the new text streams will likely save you a few lines of code.
The ``setcontents`` and ``getcontents`` methods have also grown a few parameters in order to work with text files. So you won't require an extra encode / decode step for text files. The ``setcontents`` and ``getcontents`` methods have also grown a few parameters in order to work with text files. So you won't require an extra encode / decode step for text files.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment