[weboob] [patch] pipe support for webcontentedit

Goffi goffi at goffi.org
Sat Mar 9 15:09:53 CET 2013


G'day,

I want to use webcontentedit to automatically update some pages of my 
wiki, but it's only working with interactive editing (through $EDITOR or 
vim). So I have added tty detection to webcontentedit. It's my first 
patch to weboob - but I have others in mind (like a BeWelcome backend) 
-, so let me know if anything is wrong with the coding style. The wiki 
say to send a patch with "git format-patch -n -s origin", but I use 
mercurial, so I hope the patch format is alright (it's git format anyway).

Some remarks:

- not a big deal but "id" is used as a variable name, as it is a 
reserved word is should be renamed

- my patch still get the content from the website before pushing the new 
one, it's a bit stupid, but I wanted to stay the closer as possible to 
the current edit command. In my opinion, it should have a "push" command 
to do this, which only erase the content with a new one, so I send this 
patch for discussion, but I can rewrite it with a new push command which 
doesn't get former content.

- is there a way to give arguments to a command ? Currently I have to 
use default values for message (commit message) and minor (say if it's a 
major change or not), i.e. empty string and False, but I'd like to be 
able to give them when in push my text, something like:
webcontentedit my_page --message "bla bla" --minor < my_new_page_content.txt

- if there are more than one page to edit, I exit with the error code 
"2", which according to 
http://git.symlink.me/?p=laurentb/weboob.git;a=commit;h=8075d538f07ad11bc56e36b44d902acf83da1736 
means "user input errors".

- I also think there should be a "get" command, webcontentedit could 
also be used to just get some information (e.g.: wikipedia article, or 
wiktionary definition).

Hope this will be useful, any feedback welcome

Cheers
Goffi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_webcontentedit_pipe.patch
Type: text/x-diff
Size: 6709 bytes
Desc: not available
URL: <https://lists.symlink.me/pipermail/weboob/attachments/20130309/607837d2/attachment.patch>


More information about the weboob mailing list