2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

copy: added optional arguments for device creation

git-svn-id: https://svn.fhem.de/fhem/trunk@12200 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2016-09-23 18:41:25 +00:00
parent 3be4676238
commit 60107e50ab
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: new optional arguments for device creation in copy command
- bugfix: 49_SSCam: bugfix of get presets, get patrols of zoom-cams
without pan/tilt
- updated: 74_AMAD: New Version 2.6.3 new Reading userFlowState,

View File

@ -11,7 +11,7 @@ sub
copy_Initialize($)
{
my %lhash = ( Fn=>"CommandCopy",
Hlp=>"<orig name> <copy name>" );
Hlp=>"<orig name> <copy name> [<type dependent arguments>]" );
$cmds{copy} = \%lhash;
}
@ -22,13 +22,18 @@ CommandCopy($$)
my @args = split(/ +/,$param);
return "Usage: copy <orig name> <copy name>" if (@args != 2);
return "Usage: copy <orig name> <copy name> [<type dependent arguments>]" if (@args < 2);
my $d = $defs{$args[0]};
return "$args[0] not defined" if( !$d );
my $cmd = "$args[1] $d->{TYPE}";
$cmd .= " $d->{DEF}" if( $d->{DEF} );
if( $args[2] ) {
$cmd .= ' '. join( ' ', @args[2..@args-1]);
} else {
$cmd .= " $d->{DEF}" if( $d->{DEF} );
}
my $ret = CommandDefine($hash, $cmd );
return $ret if( $ret );
@ -56,9 +61,10 @@ CommandCopy($$)
<a name="copy"></a>
<h3>copy</h3>
<ul>
<code>copy &lt;orig name&gt; &lt;copy name&gt;</code><br>
<code>copy &lt;orig name&gt; &lt;copy name&gt; [&lt;type dependent arguments&gt;]</code><br>
<br>
Create a copy of device &lt;orig name&gt; with the name &lt;copy name&gt;.
Create a copy of device &lt;orig name&gt; with the name &lt;copy name&gt;.<br>
If &lt;type dependent arguments&gt; are given they will replace the DEF of &lt;orig name&gt; for the creation of &lt;copy name&gt;.
</ul>
=end html
@ -68,9 +74,10 @@ CommandCopy($$)
<a name="copy"></a>
<h3>copy</h3>
<ul>
<code>copy &lt;orig name&gt; &lt;copy name&gt;</code><br>
<code>copy &lt;orig name&gt; &lt;copy name&gt; [&lt;type dependent arguments&gt;]</code><br>
<br>
Erzeugt eine Kopie des Device &lt;orig name&gt; mit dem namen &lt;copy name&gt;.
Erzeugt eine Kopie des Device &lt;orig name&gt; mit dem namen &lt;copy name&gt;.<br>
Wenn &lt;type dependent arguments&gt; angegeben sind ersetzen die die DEF von &lt;orig name&gt; beim anlegen von &lt;copy name&gt;.
</ul>
=end html_DE