Skip to content

readline: completion support#20559

Merged
spytheman merged 8 commits intovlang:masterfrom
felipensp:readline_completion
Jan 16, 2024
Merged

readline: completion support#20559
spytheman merged 8 commits intovlang:masterfrom
felipensp:readline_completion

Conversation

@felipensp
Copy link
Copy Markdown
Member

Usage:

import readline

fn main() {
	list := ['mem', 'memory', 'method']


	mut r := readline.Readline{
		// completion_list: list
		// or   
		completion_callback: fn [list] (prefix string) []string {
			return list.filter(it.starts_with(prefix))
		}
	}

	dump(r.read_line('prompt> ')!)
}

@felipensp felipensp marked this pull request as ready for review January 16, 2024 19:30
Comment thread vlib/readline/readline_nix.c.v Outdated
Comment thread vlib/readline/readline_nix.c.v Outdated
Comment thread vlib/readline/readline_nix.c.v Outdated
felipensp and others added 2 commits January 16, 2024 17:55
Co-authored-by: Delyan Angelov <delian66@gmail.com>
Co-authored-by: Delyan Angelov <delian66@gmail.com>
Comment thread vlib/readline/readline_nix.c.v
Co-authored-by: Delyan Angelov <delian66@gmail.com>
Comment thread vlib/readline/readline_nix.c.v Outdated
Copy link
Copy Markdown
Contributor

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, done very quickly.
Hats off to you @felipensp 🙇🏻‍♂️ .

@spytheman spytheman merged commit 8d5f95d into vlang:master Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants