Skip to content

Commit

Permalink
Various CI fixes (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 17, 2022
1 parent 779df5f commit 44eccfd
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 49 deletions.
39 changes: 23 additions & 16 deletions META6.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"auth" : "zef:raku-community-modules",
"perl" : "6.*",
"name" : "Linenoise",
"license" : "MIT",
"version" : "0.1.2",
"description" : "Raku bindings to linenoise",
"author" : "Rob Hoelz",
"depends" : [ ],
"build-depends" : ["LibraryMake"],
"source-url" : "https://github.com/raku-community-modules/Linenoise.git",
"provides": {
"Linenoise": "lib/Linenoise.rakumod"
},
"resources": [
"libraries/linenoise"
]
"auth": "zef:raku-community-modules",
"author": "Rob Hoelz",
"build-depends": [
"LibraryMake"
],
"depends": [
],
"description": "Raku bindings to linenoise",
"license": "MIT",
"name": "Linenoise",
"perl": "6.*",
"provides": {
"Linenoise": "lib/Linenoise.rakumod"
},
"resources": [
"libraries/linenoise"
],
"source-url": "https://github.com/raku-community-modules/Linenoise.git",
"tags": [
],
"test-depends": [
],
"version": "0.1.2"
}
5 changes: 5 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ filename = lib/Linenoise.rakumod.in

[Badges]
provider = github-actions/test.yml
provider = github-actions/macos.yml
provider = github-actions/windows.yml

[AutoScanPackages]
enabled = false
89 changes: 56 additions & 33 deletions lib/Linenoise.rakumod.in
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use v6;

use NativeCall;

#| This module provides bindings to linenoise
#| (L<https://github.com/antirez/linenoise>) for Perl 6
#| (L<https://github.com/antirez/linenoise>) for Raku
#| via NativeCall.
module Linenoise:ver<0.1.1>:auth<github:hoelzro> {
module Linenoise:ver<0.1.2>:auth<zef:raku-community-modules> {
my constant STDIN_FILENO = 0;
my constant F_GETFL = #`(FILL-ME-IN);
my constant F_SETFL = #`(FILL-ME-IN);
my constant O_NONBLOCK = #`(FILL-ME-IN);
my constant CLIB = #`(FILL-ME-IN);

my constant LIBLINENOISE = %?RESOURCES<libraries/linenoise>.Str;
my constant LIBLINENOISE = %?RESOURCES<libraries/linenoise>;

my sub fcntl(int32 $fd, int32 $cmd, int32 $arg) returns int32 is native(Str) { * }
my sub free(Pointer $p) is native(CLIB) { * }
Expand Down Expand Up @@ -98,58 +96,83 @@ module Linenoise:ver<0.1.1>:auth<github:hoelzro> {

Linenoise

=head1 AUTHOR
=head1 SYNOPSIS

Rob Hoelz <rob AT hoelz.ro>
=begin code :lang<raku>

=head1 SYNOPSIS
use Linenoise;

use Linenoise;
while (my $line = linenoise '> ').defined {
say "got a line: $line";
}

while (my $line = linenoise '> ').defined {
say "got a line: $line";
}
=end code

=head1 DESCRIPTION

This module provides bindings to linenoise
(L<https://github.com/antirez/linenoise>) for Perl 6 via NativeCall.
(L<https://github.com/antirez/linenoise>) for Raku via NativeCall.

=head1 EXAMPLES

=head2 Basic History

use Linenoise;
=begin code :lang<raku>

my constant HIST_FILE = '.myhist';
my constant HIST_LEN = 10;
use Linenoise;

linenoiseHistoryLoad(HIST_FILE);
linenoiseHistorySetMaxLen(HIST_LEN);
my constant HIST_FILE = '.myhist';
my constant HIST_LEN = 10;

while (my $line = linenoise '> ').defined {
linenoiseHistoryAdd($line);
say "got a line: $line";
}
linenoiseHistoryLoad(HIST_FILE);
linenoiseHistorySetMaxLen(HIST_LEN);

while (my $line = linenoise '> ').defined {
linenoiseHistoryAdd($line);
say "got a line: $line";
}

linenoiseHistorySave(HIST_FILE);
linenoiseHistorySave(HIST_FILE);

=end code

=head2 Tab Completion

use Linenoise;
=begin code :lang<raku>

my @commands = <help quit list get set>;
use Linenoise;

linenoiseSetCompletionCallback(-> $line, $c {
my ( $prefix, $last-word ) = find-last-word($line);
my @commands = <help quit list get set>;

for @commands.grep(/^ "$last-word" /).sort -> $cmd {
linenoiseAddCompletion($c, $prefix ~ $cmd);
}
});
linenoiseSetCompletionCallback(-> $line, $c {
my ( $prefix, $last-word ) = find-last-word($line);

while (my $line = linenoise '> ').defined {
say "got a line: $line";
for @commands.grep(/^ "$last-word" /).sort -> $cmd {
linenoiseAddCompletion($c, $prefix ~ $cmd);
}
});

while (my $line = linenoise '> ').defined {
say "got a line: $line";
}

=end code

=head1 AUTHOR

Rob Hoelz <rob AT hoelz.ro>

Source can be located at: https://github.com/raku-community-modules/Linenoise .
Comments and Pull Requests are welcome.

=head1 COPYRIGHT AND LICENSE

Copyright 2015 - 2017 Rob Hoelz

Copyright 2018 - 2022 Raku Community

This library is free software; you can redistribute it and/or modify it under the MIT license.

=end pod

# vim: expandtab shiftwidth=4

0 comments on commit 44eccfd

Please sign in to comment.