Skip to content

Instantly share code, notes, and snippets.

@trygveaa
Created March 3, 2022 16:30
Show Gist options
  • Save trygveaa/f91977dde5d2876d502bf55fbf9b50cc to your computer and use it in GitHub Desktop.
Save trygveaa/f91977dde5d2876d502bf55fbf9b50cc to your computer and use it in GitHub Desktop.
WeeChat scripts to test config_new_option with null in all the scripting languages
weechat.register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "")
var config_file = weechat.config_new("slack", "", "")
var config_team_default = weechat.config_new_section(
config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
var config_team = weechat.config_new_section(
config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
var option1 = weechat.config_new_option(
config_file,
config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
"",
"",
"",
"",
"",
""
)
var option2 = weechat.config_new_option(
config_file,
config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
null,
null,
1,
"",
"",
"",
"",
"",
""
)
weechat.config_read(config_file)
local weechat = weechat
if weechat.register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "") then
local config_file = weechat.config_new("slack", "", "")
local config_team_default = weechat.config_new_section(
config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
local config_team = weechat.config_new_section(
config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
local option1 = weechat.config_new_option(
config_file,
config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
"",
"",
"",
"",
"",
""
)
local option2 = weechat.config_new_option(
config_file,
config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
nil,
nil,
1,
"",
"",
"",
"",
"",
""
)
weechat.config_read(config_file)
end
<?php
weechat_register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "");
$cb = function() { };
$config_file = weechat_config_new("slack", $cb, "");
$config_team_default = weechat_config_new_section(
$config_file, "team_default", 0, 0, $cb, "", $cb, "", $cb, "", $cb, "", $cb, ""
);
$config_team = weechat_config_new_section(
$config_file, "team", 0, 0, $cb, "", $cb, "", $cb, "", $cb, "", $cb, ""
);
$option1 = weechat_config_new_option(
$config_file,
$config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
$cb,
"",
$cb,
"",
$cb,
""
);
$option2 = weechat_config_new_option(
$config_file,
$config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
NULL,
NULL,
1,
$cb,
"",
$cb,
"",
$cb,
""
);
weechat_config_read($config_file);
?>
weechat::register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "");
my $config_file = weechat::config_new("slack", "", "");
my $config_team_default = weechat::config_new_section(
$config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
);
my $config_team = weechat::config_new_section(
$config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
);
my $option1 = weechat::config_new_option(
$config_file,
$config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
"",
"",
"",
"",
"",
"",
);
my $option2 = weechat::config_new_option(
$config_file,
$config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
undef,
undef,
1,
"",
"",
"",
"",
"",
"",
);
weechat::config_read(config_file);
# pylint: disable=missing-module-docstring disable=missing-function-docstring
# pyright: strict, reportMissingModuleSource=false
import weechat # pylint: disable=import-error
if weechat.register("script_config", "trygveaa", "0.0.1", "MIT", "", "", ""):
config_file = weechat.config_new("slack", "", "")
config_team_default = weechat.config_new_section(
config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
config_team = weechat.config_new_section(
config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
option1 = weechat.config_new_option(
config_file,
config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
"",
"",
"",
"",
"",
"",
)
option2 = weechat.config_new_option(
config_file,
config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
None,
None,
1,
"",
"",
"",
"",
"",
"",
)
weechat.config_read(config_file)
def weechat_init
Weechat.register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "")
config_file = Weechat.config_new("slack", "", "")
config_team_default = Weechat.config_new_section(
config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
config_team = Weechat.config_new_section(
config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
option1 = Weechat.config_new_option(
config_file,
config_team_default,
"auto_open_threads",
"boolean",
"description",
"",
0,
0,
"on",
"on",
0,
["",
"",
"",
"",
"",
""]
)
option2 = Weechat.config_new_option(
config_file,
config_team,
"team1.auto_open_threads << slack.team_default.auto_open_threads",
"boolean",
"description",
"",
0,
0,
nil,
nil,
1,
["",
"",
"",
"",
"",
""]
)
Weechat.config_read(config_file)
end
(weechat:register "script_config" "trygveaa" "0.0.1" "MIT" "" "" "")
(define config_file (weechat:config_new "slack" "" ""))
(define config_team_default (weechat:config_new_section
(list config_file "team_default" 0 0 "" "" "" "" "" "" "" "" "" "")
))
(define config_team (weechat:config_new_section
(list config_file "team" 0 0 "" "" "" "" "" "" "" "" "" "")
))
(define option1 (weechat:config_new_option
(list config_file
config_team_default
"auto_open_threads"
"boolean"
"description"
""
0
0
"on"
"on"
0
""
""
""
""
""
"")
))
(define option2 (weechat:config_new_option
(list config_file
config_team
"team1.auto_open_threads << slack.team_default.auto_open_threads"
"boolean"
"description"
""
0
0
#nil
#nil
1
""
""
""
""
""
"")
))
(weechat:config_read config_file)
weechat::register "script_config" "trygveaa" "0.0.1" "MIT" "" "" ""
set config_file [weechat::config_new "slack" "" ""]
set config_team_default [weechat::config_new_section \
$config_file "team_default" 0 0 "" "" "" "" "" "" "" "" "" ""]
set config_team [weechat::config_new_section \
$config_file "team" 0 0 "" "" "" "" "" "" "" "" "" ""]
set option1 [weechat::config_new_option \
$config_file \
$config_team_default \
"auto_open_threads" \
"boolean" \
"description" \
"" \
0 \
0 \
"on" \
"on" \
0 \
"" \
"" \
"" \
"" \
"" \
""]
set option2 [weechat::config_new_option \
$config_file \
$config_team \
"team1.auto_open_threads << slack.team_default.auto_open_threads" \
"boolean" \
"description" \
"" \
0 \
0 \
$::weechat::WEECHAT_NULL \
$::weechat::WEECHAT_NULL \
1 \
"" \
"" \
"" \
"" \
"" \
""]
weechat::config_read $config_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment