Hello community, here is the log from the commit of package go-go-readline for openSUSE:Factory checked in at 2012-03-08 19:43:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go-go-readline (Old) and /work/SRC/openSUSE:Factory/.go-go-readline.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "go-go-readline", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/go-go-readline/go-go-readline.changes 2012-01-19 09:42:04.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.go-go-readline.new/go-go-readline.changes 2012-03-08 19:43:13.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Mar 6 10:26:28 UTC 2012 - gra...@andtech.eu + +- update for weekly.2012-03-04 + +------------------------------------------------------------------- Old: ---- go-readline-0.0.0+hg20120110.tar.bz2 go-readline-fix-local-imports.patch New: ---- go-readline-0.0.0+hg20120304.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go-go-readline.spec ++++++ --- /var/tmp/diff_new_pack.eaFLc5/_old 2012-03-08 19:43:14.000000000 +0100 +++ /var/tmp/diff_new_pack.eaFLc5/_new 2012-03-08 19:43:14.000000000 +0100 @@ -16,16 +16,16 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + + Name: go-go-readline -Version: 0.0.0+hg20120110 +Version: 0.0.0+hg20120304 Release: 0 Summary: Readline support for Go License: BSD-2-Clause Group: Development/Languages/Other Url: https://bitbucket.org/binet/go-readline/ Source0: go-readline-%{version}.tar.bz2 -# PATCH-FIX-OPENSUSE -- Need different import statements for local build -Patch0: go-readline-fix-local-imports.patch BuildRequires: go-devel BuildRequires: readline-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -38,14 +38,15 @@ %prep %setup -q -n go-readline -%patch0 -p1 %build +%goprep bitbucket.org/binet/go-readline +%gobuild pkg/readline + %install -%{go_make_install} +%goinstall %check -%{go_make_test} %files %defattr(-,root,root,-) ++++++ go-readline-0.0.0+hg20120110.tar.bz2 -> go-readline-0.0.0+hg20120304.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-readline/Makefile new/go-readline/Makefile --- old/go-readline/Makefile 2012-01-10 09:42:15.000000000 +0100 +++ new/go-readline/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -# Copyright 2009 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -include $(GOROOT)/src/Make.inc - -TARG=bitbucket.org/binet/go-readline -CGOFILES=readline.go -CGO_LDFLAGS=-lreadline - -CLEANFILES+=readline_test - -include $(GOROOT)/src/Make.pkg - -%: install %.go - $(GC) $*.go - $(LD) -o $@ $*.$O diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-readline/pkg/readline/readline.go new/go-readline/pkg/readline/readline.go --- old/go-readline/pkg/readline/readline.go 1970-01-01 01:00:00.000000000 +0100 +++ new/go-readline/pkg/readline/readline.go 2012-03-06 11:22:48.000000000 +0100 @@ -0,0 +1,147 @@ +// Wrapper around the GNU readline(3) library + +package readline + +// TODO: +// implement a go-oriented command completion + +/* + #cgo LDFLAGS: -lreadline + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <readline/readline.h> + #include <readline/history.h> + + char* _go_readline_strarray_at(char **strarray, int idx) + { + return strarray[idx]; + } + + int _go_readline_strarray_len(char **strarray) + { + int sz = 0; + while (strarray[sz] != NULL) { + sz += 1; + } + return sz; + } +*/ +import "C" +import "unsafe" +import "syscall" + +func ReadLine(prompt *string) *string { + var p *C.char + + //readline allows an empty prompt(NULL) + if prompt != nil { + p = C.CString(*prompt) + } + + ret := C.readline(p) + + if p != nil { + C.free(unsafe.Pointer(p)) + } + + if ret == nil { + return nil + } //EOF + + s := C.GoString(ret) + C.free(unsafe.Pointer(ret)) + return &s +} + +func AddHistory(s string) { + p := C.CString(s) + defer C.free(unsafe.Pointer(p)) + C.add_history(p) +} + +// Parse and execute single line of a readline init file. +func ParseAndBind(s string) { + p := C.CString(s) + defer C.free(unsafe.Pointer(p)) + C.rl_parse_and_bind(p) +} + +// Parse a readline initialization file. +// The default filename is the last filename used. +func ReadInitFile(s string) error { + p := C.CString(s) + defer C.free(unsafe.Pointer(p)) + errno := C.rl_read_init_file(p) + if errno == 0 { + return nil + } + return syscall.Errno(errno) +} + +// Load a readline history file. +// The default filename is ~/.history. +func ReadHistoryFile(s string) error { + p := C.CString(s) + defer C.free(unsafe.Pointer(p)) + errno := C.read_history(p) + if errno == 0 { + return nil + } + return syscall.Errno(errno) +} + +var ( + HistoryLength = -1 +) + +// Save a readline history file. +// The default filename is ~/.history. +func WriteHistoryFile(s string) error { + p := C.CString(s) + defer C.free(unsafe.Pointer(p)) + errno := C.write_history(p) + if errno == 0 && HistoryLength >= 0 { + errno = C.history_truncate_file(p, C.int(HistoryLength)) + } + if errno == 0 { + return nil + } + return syscall.Errno(errno) +} + +// Set the readline word delimiters for tab-completion +func SetCompleterDelims(break_chars string) { + p := C.CString(break_chars) + //defer C.free(unsafe.Pointer(p)) + C.free(unsafe.Pointer(C.rl_completer_word_break_characters)) + C.rl_completer_word_break_characters = p +} + +// Get the readline word delimiters for tab-completion +func GetCompleterDelims() string { + cstr := C.rl_completer_word_break_characters + delims := C.GoString(cstr) + return delims +} + +// +func CompletionMatches(text string, cbk func(text string, state int) string) []string { + c_text := C.CString(text) + defer C.free(unsafe.Pointer(c_text)) + c_cbk := (*C.rl_compentry_func_t)(unsafe.Pointer(&cbk)) + c_matches := C.rl_completion_matches(c_text, c_cbk) + n_matches := int(C._go_readline_strarray_len(c_matches)) + matches := make([]string, n_matches) + for i := 0; i < n_matches; i++ { + matches[i] = C.GoString(C._go_readline_strarray_at(c_matches, C.int(i))) + } + return matches +} + +// +func SetAttemptedCompletionFunction(cbk func(text string, start, end int) []string) { + c_cbk := (*C.rl_completion_func_t)(unsafe.Pointer(&cbk)) + C.rl_attempted_completion_function = c_cbk +} +/* EOF */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-readline/readline.go new/go-readline/readline.go --- old/go-readline/readline.go 2012-01-10 09:42:15.000000000 +0100 +++ new/go-readline/readline.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,147 +0,0 @@ -// Wrapper around the GNU readline(3) library - -package readline - -// TODO: -// implement a go-oriented command completion - -/* - #cgo LDFLAGS: -lreadline - #include <stdio.h> - #include <stdlib.h> - #include <string.h> - #include <readline/readline.h> - #include <readline/history.h> - - char* _go_readline_strarray_at(char **strarray, int idx) - { - return strarray[idx]; - } - - int _go_readline_strarray_len(char **strarray) - { - int sz = 0; - while (strarray[sz] != NULL) { - sz += 1; - } - return sz; - } -*/ -import "C" -import "unsafe" -import "syscall" - -func ReadLine(prompt *string) *string { - var p *C.char - - //readline allows an empty prompt(NULL) - if prompt != nil { - p = C.CString(*prompt) - } - - ret := C.readline(p) - - if p != nil { - C.free(unsafe.Pointer(p)) - } - - if ret == nil { - return nil - } //EOF - - s := C.GoString(ret) - C.free(unsafe.Pointer(ret)) - return &s -} - -func AddHistory(s string) { - p := C.CString(s) - defer C.free(unsafe.Pointer(p)) - C.add_history(p) -} - -// Parse and execute single line of a readline init file. -func ParseAndBind(s string) { - p := C.CString(s) - defer C.free(unsafe.Pointer(p)) - C.rl_parse_and_bind(p) -} - -// Parse a readline initialization file. -// The default filename is the last filename used. -func ReadInitFile(s string) error { - p := C.CString(s) - defer C.free(unsafe.Pointer(p)) - errno := C.rl_read_init_file(p) - if errno == 0 { - return nil - } - return syscall.Errno(errno) -} - -// Load a readline history file. -// The default filename is ~/.history. -func ReadHistoryFile(s string) error { - p := C.CString(s) - defer C.free(unsafe.Pointer(p)) - errno := C.read_history(p) - if errno == 0 { - return nil - } - return syscall.Errno(errno) -} - -var ( - HistoryLength = -1 -) - -// Save a readline history file. -// The default filename is ~/.history. -func WriteHistoryFile(s string) error { - p := C.CString(s) - defer C.free(unsafe.Pointer(p)) - errno := C.write_history(p) - if errno == 0 && HistoryLength >= 0 { - errno = C.history_truncate_file(p, C.int(HistoryLength)) - } - if errno == 0 { - return nil - } - return syscall.Errno(errno) -} - -// Set the readline word delimiters for tab-completion -func SetCompleterDelims(break_chars string) { - p := C.CString(break_chars) - //defer C.free(unsafe.Pointer(p)) - C.free(unsafe.Pointer(C.rl_completer_word_break_characters)) - C.rl_completer_word_break_characters = p -} - -// Get the readline word delimiters for tab-completion -func GetCompleterDelims() string { - cstr := C.rl_completer_word_break_characters - delims := C.GoString(cstr) - return delims -} - -// -func CompletionMatches(text string, cbk func(text string, state int) string) []string { - c_text := C.CString(text) - defer C.free(unsafe.Pointer(c_text)) - c_cbk := (*C.rl_compentry_func_t)(unsafe.Pointer(&cbk)) - c_matches := C.rl_completion_matches(c_text, c_cbk) - n_matches := int(C._go_readline_strarray_len(c_matches)) - matches := make([]string, n_matches) - for i := 0; i < n_matches; i++ { - matches[i] = C.GoString(C._go_readline_strarray_at(c_matches, C.int(i))) - } - return matches -} - -// -func SetAttemptedCompletionFunction(cbk func(text string, start, end int) []string) { - c_cbk := (*C.rl_completion_func_t)(unsafe.Pointer(&cbk)) - C.rl_attempted_completion_function = c_cbk -} -/* EOF */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-readline/readline_test.go new/go-readline/readline_test.go --- old/go-readline/readline_test.go 2012-01-10 09:42:15.000000000 +0100 +++ new/go-readline/readline_test.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -// test program for the readline package -package main - -import "readline" - -func main() { - prompt := "by your command> "; - - //loop until ReadLine returns nil (signalling EOF) - L: for { - switch result := readline.ReadLine(&prompt); true { - case result == nil: break L //exit loop - - case *result != "": //ignore blank lines - println(*result); - readline.AddHistory(*result); //allow user to recall this line - } - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-readline/test/readline_test.go new/go-readline/test/readline_test.go --- old/go-readline/test/readline_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/go-readline/test/readline_test.go 2012-03-06 11:22:48.000000000 +0100 @@ -0,0 +1,19 @@ +// test program for the readline package +package main + +import "readline" + +func main() { + prompt := "by your command> "; + + //loop until ReadLine returns nil (signalling EOF) + L: for { + switch result := readline.ReadLine(&prompt); true { + case result == nil: break L //exit loop + + case *result != "": //ignore blank lines + println(*result); + readline.AddHistory(*result); //allow user to recall this line + } + } +} -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org