asdf 64474c4d56 | ||
---|---|---|
.gitignore | ||
LICENSE | ||
README.md | ||
VERSION | ||
go.mod | ||
main.go | ||
main_test.go | ||
makefile |
README.md
gfu - gophermap format utility
gfu
manipulates gophermaps (gopher menus). It is intended to be used as part of an automation chain for managing a gopherhole using maps as the main doctype, easily allowing any document to contain links.
gfu
can:
- Convert all lines in a file that are not valid gopher links into gopher info text (item type 'i') lines
- Deconstructing all gopher info text lines in a file back to plain text for easy editing
- Insert the contents of a header file to the start of a document
- Append the contents of a footer file to the end of a document
Getting Started
These instructions will get a copy of the project up and running on your local machine.
Prerequisites
If building from source, you will need to have Go version 1.10 installed.
Installing
Assuming you have go
installed, run the following:
git clone https://tildegit.org/sloum/gfu.git
cd gfu
make install
Assuming go install
is set up to install to a place on your path, you should be able to execute gfu
from the terminal:
gfu
Troubleshooting
If you run gfu
and get gfu: command not found
, try running make
from within the cloned repo. Then try: ./gfu
. If that works it means that Go does not install to your path. make
added an executable file to the repo directory. Move that file to somewhere on your path. I suggest /usr/local/bin
on most systems, but that may be a matter of personal preference.
Downloading
If you would prefer to download a binary for your system, rather than build from source, please visit the gfu downloads page.
Documentation
Syntax
gfu [options...] [input-file]
Please note that the options must be specified before the input file.
Input and output options
Input is read from the file specified as [input-file]. If no file is specified, input is read from stdin.
Output is printed to stdout by default. To output to a specific file, use the --output option.
If you have specified an input file, and want to save output to that same file, use the --in-place option.
Options
Default Construct plain text lines from gophermap info text (item type 'i') lines.
-d
--deconstruct
Deconstruct gophermap info text (item type 'i') lines into plain text lines.
-h <file>
--header <file>
Insert the contents of the specified file at the beginning of any output. The contents of this file are also constructed or deconstructed by this application.
-f <file>
--footer <file>
Append the contents of the specified file to the end of any output. The contents of this file are also constructed or deconstructed by this application.
-i
--in-place
Processing is done in-place, saving any changes to the specified input file. No backup is taken.
-o
--outfile <file>
Save processed output to the specified file.
-v
--version
Print version information and exit.
Examples
gfu /path/to/file
Read a file and convert any plain text lines to gophermap info text lines.
gfu -d /path/to/file
Read a file and convert any gophermap info text lines to plain text.
gfu -head /path/to/headerfile /path/to/file
Inserts headerfile before the input file. Will also convert any plain text lines to gophermap info text lines.
gfu -head headerfile -foot footerfile ~/gopher/phlog/gophermap
Inserts headerfile before the start the input file, then appends footerfile to the end of the input file. Will also convert any plain text lines to gophermap info text lines.
gfu -o /path/to/outputfile /path/to/inputfile
Read and process inputfile, saving output to outputfile.
gfu -i /path/to/inputfile
Read and process inputfile, saving output in-place to inputfile.
otherapp | gfu
Use redirection to pipe the output of another application to gfu. gfu will convert any plain text lines to info text lines, then print the output to stdout.
gfu ~/gopher/phlog/gophermap > ~/gopher/phlog/new_gophermap
gfu -d ~/gopher/phlog/gophermap | cowsay
Use redirection to save your processed gophermap to a new file, or have a cow read your interesting phlog post (in plain text) back to you.
Further reading
Please see the gfu homepage for more information about gfu
.
Contributing
If you would like to get involved, please submit an issue. At present the developers use the tildegit issues system to discuss new features, track bugs, and communicate with users about hopes and/or issues for/with the software.
License
This project is licensed under the GNU GPL version 3 - see the LICENSE file for details.