FLAG (Fanfiction.net Lightweight Automated Grabber) is a web-based service for downloading fanfiction as ebook files from any of several popular sites. Files are available for direct download, or can be optionally emailed to the user's email address.
 Supported Output Formats
 Supported Source Websites
 CLI Application
FLAG was previously offered as a commandline application, however this version was retired in early 2011. Old versions of the CLI program are available in the MobileRead forum as a tarball.
Note that the CLI version was written with a Sony PRS-505 in mind, for Linux systems. It requires php5-cli, php5-curl and php5-tidy be installed for it to work properly. A Windows version is also available but may not have all the features of the Linux version.
Instructions for the CLI tool can be found by running "./fflag --help".