Skip to content
Snippets Groups Projects
Select Git revision
  • dc0e54c275e27fc16572e624c1ca542c09bea159
  • master default protected
  • rednatco-v2
  • base-pairs-ladder
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

table.ts

Blame
  • method.dart 2.09 KiB
    import 'package:scp_meta/copy.dart';
    import 'package:scp_meta/options.dart';
    import 'package:scp_meta/storage.dart';
    
    class Method {
      final Storage src;
      final Storage dst;
      final Copy method;
      final Options opt;
    
      /// konstruktor
      Method(this.src, this.dst, this.method, this.opt);
    
      String selectCommand(bool cond, String command, String last) {
        if (cond == true) {
          print('+ $command'); // DEBUG
          return (last.isEmpty) ? command : last;
        }
        else {
          print('- $command'); // DEBUG
          return last;
        }
      }
    
      String getCommand() {
        String best = '';
        print("SRC: ${src.getFqdn()} -> DST: ${dst.getFqdn()}");
        best = selectCommand(
            src.getFqdn() == dst.getFqdn() && src.isScpRemote(),
            "ssh ${src.getAsSsh()} 'cp ${opt.getAsCp()} ${src.getScpPath()} ${dst.getScpPath()}'",
            best);
    
        best = selectCommand(
            src.isScpDirect() && dst.isScpRemote(),
            "scp ${opt.getAsScp(remove:['3'])} ${src.getAsScp()} ${dst.getAsScp()}",
            best);
    
        best = selectCommand(
            src.isScpRemote() && dst.isScpDirect() && !opt.isDefinedPort(),
            "ssh ${dst.getAsSsh()} 'scp ${opt.getAsScp(remove:['3'])} ${src.getAsScp()} ${dst.getAsCp()}'",
            best);
    
        best = selectCommand(
            src.isScpRemote() && dst.isScpRemote(),
            "scp -3 ${opt.getAsScp(remove:['3'])} ${src.getAsScp()} ${dst.getAsScp()}",
            best);
    
        best = selectCommand(
            src.isCopy() && dst.isScpRemote(),
            "scp ${opt.getAsCp()} ${src.getAsCp()} ${dst.getAsScp()}",
            best);
    
        best = selectCommand(
            src.isScpRemote() && dst.isCopy(),
            "scp ${opt.getAsScp()} ${src.getAsCp()} ${dst.getAsScp()}",
            best);
    
        best = selectCommand(
            src.isScpRemote() && dst.isCopy(),
            "scp ${opt.getAsScp()} ${src.getAsScp()} ${dst.getAsCp()}",
            best);
    
        best = selectCommand(
            true,
            "scp ${opt.getAsScp()} ${src.getAsOrigin()} ${dst.getAsOrigin()}",
            best);
        return best;
      }