mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
98_help.pm: add support for "help global"
git-svn-id: https://svn.fhem.de/fhem/trunk@8045 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
06fa9ef3de
commit
6a2c2a8af3
@ -21,41 +21,66 @@ sub CommandHelp {
|
||||
$lang = (lc($lang) eq 'de') ? '_DE' : '';
|
||||
|
||||
if($mod) {
|
||||
|
||||
$mod = lc($mod);
|
||||
my %mods;
|
||||
my $modPath = AttrVal('global','modpath','.');
|
||||
my @modDir = ("$modPath/FHEM");
|
||||
foreach my $modDir (@modDir) {
|
||||
opendir(DH, $modDir) || die "Cant open $modDir: $!\n";
|
||||
while(my $l = readdir DH) {
|
||||
next if($l !~ m/^\d\d_.*\.pm$/);
|
||||
my $of = $l;
|
||||
$l =~ s/.pm$//;
|
||||
$l =~ s/^[0-9][0-9]_//;
|
||||
$mods{lc($l)} = "$modDir/$of";
|
||||
}
|
||||
}
|
||||
my $output = "";
|
||||
|
||||
return "Module $mod not found" unless defined($mods{$mod});
|
||||
if($mod ne 'global') {
|
||||
my %mods;
|
||||
my @modDir = ("$modPath/FHEM");
|
||||
|
||||
my $output = "";
|
||||
my $skip = 1;
|
||||
my ($err,@text) = FileRead({FileName => $mods{$mod}, ForceType => 'file'});
|
||||
return $err if $err;
|
||||
foreach my $l (@text) {
|
||||
if($l =~ m/^=begin html$lang$/) {
|
||||
$skip = 0;
|
||||
} elsif($l =~ m/^=end html$lang$/) {
|
||||
$skip = 1;
|
||||
} elsif(!$skip) {
|
||||
$output .= $l;
|
||||
}
|
||||
}
|
||||
foreach my $modDir (@modDir) {
|
||||
opendir(DH, $modDir) || die "Cant open $modDir: $!\n";
|
||||
while(my $l = readdir DH) {
|
||||
next if($l !~ m/^\d\d_.*\.pm$/);
|
||||
my $of = $l;
|
||||
$l =~ s/.pm$//;
|
||||
$l =~ s/^[0-9][0-9]_//;
|
||||
$mods{lc($l)} = "$modDir/$of";
|
||||
}
|
||||
}
|
||||
|
||||
$output = "Keine deutsche Hilfe gefunden!\n\n".
|
||||
return "Module $mod not found" unless defined($mods{$mod});
|
||||
|
||||
my $skip = 1;
|
||||
my ($err,@text) = FileRead({FileName => $mods{$mod}, ForceType => 'file'});
|
||||
return $err if $err;
|
||||
foreach my $l (@text) {
|
||||
if($l =~ m/^=begin html$lang$/) {
|
||||
$skip = 0;
|
||||
} elsif($l =~ m/^=end html$lang$/) {
|
||||
$skip = 1;
|
||||
} elsif(!$skip) {
|
||||
$output .= $l;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$output = '';
|
||||
my $i;
|
||||
my $f = "$modPath/docs/commandref_frame$lang.html";
|
||||
my $skip = 1;
|
||||
my ($err,@text) = FileRead({FileName => $f, ForceType => 'file'});
|
||||
return $err if $err;
|
||||
|
||||
foreach my $l (@text) {
|
||||
if($l =~ m/name=.global./) {
|
||||
$skip = 0;
|
||||
} elsif($l =~ m/^<!-- global.end/) {
|
||||
$skip = 1;
|
||||
} elsif (!$skip) {
|
||||
$output .= $l;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output = "Keine deutsche Hilfe gefunden!\n\n".
|
||||
CommandHelp(undef, "$mod en") unless $output;
|
||||
|
||||
if( $cl && $cl->{TYPE} eq 'telnet' ) {
|
||||
if( $cl && $cl->{TYPE} eq 'telnet' ) {
|
||||
$output =~ s/<br>/\n/g;
|
||||
$output =~ s/<br\/>/\n/g;
|
||||
$output =~ s/<\/a>//g;
|
||||
@ -82,11 +107,11 @@ sub CommandHelp {
|
||||
$output =~ s/ß/ß/g;
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
return "<html>$output</html>";
|
||||
return "<html>$output</html>";
|
||||
|
||||
} else {
|
||||
} else { # mod
|
||||
|
||||
my $str = "\n" .
|
||||
"Possible commands:\n\n" .
|
||||
|
@ -1413,7 +1413,7 @@ The following local attributes are used by a wider range of devices:
|
||||
hidden, and will only be visible, if this attribute is set to 1.
|
||||
The attribute is checked by the list command, by the FHEMWEB room
|
||||
overview and by xmllist.
|
||||
</li>
|
||||
</li><br/>
|
||||
|
||||
<a name="stacktrace"></a>
|
||||
<li>stacktrace<br>
|
||||
@ -1421,6 +1421,8 @@ The following local attributes are used by a wider range of devices:
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- global end - do not remove this line! -->
|
||||
|
||||
|
||||
<a name="perl"></a>
|
||||
<h3>Perl specials</h3>
|
||||
|
@ -1501,7 +1501,7 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
werden nicht angezeigt, es sei denn das globale Attribut
|
||||
showInternalValues ist gesetzt. Diese Variable wird bei dem list und
|
||||
xmllist Befehl, und bei der FHEMWEB Raumansicht geprüft.
|
||||
</li>
|
||||
</li><br/>
|
||||
|
||||
<a name="stacktrace"></a>
|
||||
<li>stacktrace<br>
|
||||
@ -1510,6 +1510,7 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- global end - diese Zeile nicht entfernen! -->
|
||||
|
||||
|
||||
<a name="perl"></a>
|
||||
|
Loading…
Reference in New Issue
Block a user