/*
 * Copyright 2016 Google, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.spinnaker.halyard.cli.command.v1;

import com.beust.jcommander.Parameter;
import lombok.AccessLevel;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * This is the base command, where we will register all the subcommands.
 */
public class HalCommand extends NestableCommand {
  @Getter(AccessLevel.PROTECTED)
  private Map<String, NestableCommand> subcommands = new HashMap<>();

  @Getter(AccessLevel.PUBLIC)
  private String commandName = "hal";

  @Parameter(
      names = "--print-bash-completion",
      description = "Print bash command completion."
  )
  private boolean printBashCompletion;

  public HalCommand() {
    registerSubcommand(new ConfigCommand());
    registerSubcommand(new DeployCommand());
    registerSubcommand(new VersionsCommand());
  }

  @Override
  public String getDescription() {
    return "Manage Spinnaker's configuration and updates";
  }

  @Override
  protected void executeThis() {
    if (printBashCompletion) {
      System.out.println(commandCompletor());
    } else {
      showHelp();
    }
  }
}

@@ -1194,10 +1194,59 @@
 ion.
+ This is used during the installation of Halyard.
 %22%0A
-
   )%0A
@@ -1514,52 +1514,1617 @@
 rn %22
-Manage Spinnaker's configuration and updates
+A tool for configuring, installing, and updating Spinnaker.%5Cn%5Cn%22%0A        + %22If this is your first time using Halyard to install Spinnaker we recommend that you skim %22%0A        + %22the documentation on www.spinnaker.io/docs for some familiarity with the product. If at any %22%0A        + %22point you get stuck using 'hal', every command can be suffixed with '--help' for usage %22%0A        + %22information. Once you are ready, these are the steps you need to follow to get an %22%0A        + %22initial configuration of Spinnaker up and running:%5Cn%5Cn%22%0A        + %221. Enable the cloud provider(s) you want to deploy to:%5Cn%22%0A        + %22  $ hal config provider $PROVIDER enable%5Cn%22%0A        + %222. Create Spinnaker accounts for the provider(s) you want to use:%5Cn%22%0A        + %22  $ hal config provider $PROVIDER account add my-account-name --help%5Cn%22%0A        + %223. Set a storage source for Spinnaker metadata:%5Cn%22%0A        + %22  $ hal config storage edit --help%5Cn%22%0A        + %224. (Optional) Set feature flags:%5Cn%22%0A        + %22  $ hal config features edit --help%5Cn%22%0A        + %225. (Optional) Configure Spinnaker's image bakery for your provider(s):%5Cn%22%0A        + %22  $ hal config provider $PROVIDER bakery --help%5Cn%22%0A        + %226. (Optional) Configure Spinnaker's security settings (authn, authz & ssl):%5Cn%22%0A        + %22  $ hal config security edit --help%5Cn%22%0A        + %227. (Optional) Configure Spinnaker's deployment profile:%5Cn%22%0A        + %22  $ hal config deploy edit --help%5Cn%22%0A        + %228. (Optional) Generate all of Spinnaker's configuration:%5Cn%22%0A        + %22  $ hal config generate%5Cn%22%0A        + %229. Deploy Spinnaker:%5Cn%22%0A        + %22  $ hal deploy run%5Cn
 %22;%0A 

Update the hal command's help text to guide a new user (#163)