this changes all api calls to respect the flags for tor and tor-port
- config now has TorPort method to return flag value if set, or default
- api now only has newClient, this creates a tor client when flag is
present. does not need to be exported anymore
- no methods take a tor argument as no longer needed
- all commands now share the same behaviour logging tor messages
- api.torClient was removed as not used anywhere
- all calls to api.newClient now check for and return the error
- api.HandlePost was removed as redundant of api.DoPost
this moves string trimming into it's own helper which accounts for the
possibility of multi-byte runes.
includes tests for ascii and utf-8 language strings
This changes the 'posts' subcommand, previously 'list', to also list any
remote posts for the user if currently authenticated.
- adds DoFetchPosts to the api pkg which returns all the logged in users
posts.
- adds a RemotePost type to the api pkg which stores some of the return
information from DoFetchPosts for use in printing to stdout
- adds GetUserPosts to the api pkg which converts the incoming
writeas.Posts into the smaller RemotePost type
- adds getExcerpt which takes the incoming writeas.Post.Content and
returns a trimmed down excerpt of the content. Max 2 lines of 80 chars
and delimited by '...'
- changes CmdList from pkg commands to CmdListPosts which now writes out
any local and remote posts in simple formatted tables
this adds a configurable directory, currently within the users path for
the configuration, user and post data to be saved.
it is accessible down the stack of the application via the cli.Context,
specificaly c.App.ExtraData which is a function that returns a map of
[string]string under the key 'configDir".
this splits everything out into shared packages
- user config and application config share a package for now
- sync is part of the api package which includes the client, posts and
tor logic
- logging is it's own package
- commands are in their own package
first moving everything out into the base package
should be followed by some refactoring and reorganizing before creating
two different binaries for write.as and writefreely
A lot has changed to the previously named codegangsta/cli library, and
this gets up to date with everything, fixing issue #8.
It also passes around errors from funcs that perform actions inside the
command funcs, for more Go-ness.
Creates a new temporary file and posts whatever was written to it once
the user exits their editor.
TODO: don't lose work if something goes wrong in the posting process