MCPcopy Create free account
hub / github.com/TrsstProject/trsst / doPush

Method doPush

src/main/java/com/trsst/Command.java:623–659  ·  view source on GitHub ↗
(Client client, CommandLine commands,
            LinkedList<String> arguments, PrintStream out)

Source from the content-addressed store, hash-verified

621 }
622
623 public int doPush(Client client, CommandLine commands,
624 LinkedList<String> arguments, PrintStream out) {
625
626 // if a second argument was specified
627 if (arguments.size() < 2) {
628 printPushUsage();
629 return 127; // "command not found"
630 }
631 URL url;
632 String host = arguments.removeFirst().toString();
633 Client destinationClient;
634 try {
635 url = new URL(host);
636 // this argument is a server url
637 destinationClient = new Client(url);
638 System.err.println("Using service: " + host);
639 } catch (MalformedURLException e) {
640 printPushUsage();
641 return 127; // "command not found"
642 }
643
644 for (String id : arguments) {
645 System.out.println(destinationClient.push(client.pull(id), url));
646 // Feed feed = client.pull(id);
647 // if ( feed != null ) {
648 // feed = client.push(feed, url);
649 // if ( feed != null ) {
650 // out.println(feed);
651 // } else {
652 // System.err.println("Failed to push feed for id: " + id);
653 // }
654 // } else {
655 // System.err.println("Failed to pull feed for id: " + id);
656 // }
657 }
658 return 0; // "OK"
659 }
660
661 public int doServe(CommandLine commands, LinkedList<String> arguments) {
662

Callers 1

doBeginMethod · 0.95

Calls 3

printPushUsageMethod · 0.95
pushMethod · 0.95
pullMethod · 0.80

Tested by

no test coverage detected