Home | History | Annotate | Download | only in impl
      1 /*
      2  * Copyright (C) 2018 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License
     15  */
     16 
     17 package com.android.dialer.commandline.impl;
     18 
     19 import android.support.annotation.NonNull;
     20 import android.support.annotation.VisibleForTesting;
     21 import android.text.TextUtils;
     22 import com.android.dialer.commandline.Arguments;
     23 import com.android.dialer.commandline.Command;
     24 import com.google.common.util.concurrent.Futures;
     25 import com.google.common.util.concurrent.ListenableFuture;
     26 import javax.inject.Inject;
     27 
     28 /** Print arguments. */
     29 public class Echo implements Command {
     30 
     31   @NonNull
     32   @Override
     33   public String getShortDescription() {
     34     return "@hide Print all arguments.";
     35   }
     36 
     37   @NonNull
     38   @Override
     39   public String getUsage() {
     40     return "echo [arguments...]";
     41   }
     42 
     43   @VisibleForTesting
     44   @Inject
     45   public Echo() {}
     46 
     47   @Override
     48   public ListenableFuture<String> run(Arguments args) throws IllegalCommandLineArgumentException {
     49     return Futures.immediateFuture(TextUtils.join(" ", args.getPositionals()));
     50   }
     51 }
     52