<commit_before>// Copyright 2015 The appc Authors
//
// 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 main

import (
	"strconv"

	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/spf13/cobra"
)

var (
	count           uint
	socketActivated bool
	cmdPort         = &cobra.Command{
		Use:   "port [command]",
		Short: "Manage ports",
	}
	cmdAddPort = &cobra.Command{
		Use:     "add NAME PROTOCOL PORT",
		Short:   "Add a port",
		Long:    "Updates the ACI to contain a port with the given name, protocol, and port. If the port already exists, its values will be changed.",
		Example: "acbuild port add https 443 tcp --socket-activated",
		Run:     runWrapper(runAddPort),
	}
	cmdRmPort = &cobra.Command{
		Use:     "remove NAME",
		Aliases: []string{"rm"},
		Short:   "Remove a port",
		Long:    "Updates the ports in the ACI's manifest to include a port with the given name and value",
		Example: "acbuild port remove https",
		Run:     runWrapper(runRmPort),
	}
)

func init() {
	cmdAcbuild.AddCommand(cmdPort)
	cmdPort.AddCommand(cmdAddPort)
	cmdPort.AddCommand(cmdRmPort)

	cmdAddPort.Flags().UintVar(&count, "count", 1, "Specifies a range of ports, going from PORT to PORT + count - 1")
	cmdAddPort.Flags().BoolVar(&socketActivated, "socket-activated", false, "Set the app to be socket activated on this/these port/ports")
}

func runAddPort(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 3 {<commit_msg>port: fix swapped protocol and port in add usage example<commit_after>// Copyright 2015 The appc Authors
//
// 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 main

import (
	"strconv"

	"github.com/appc/acbuild/Godeps/_workspace/src/github.com/spf13/cobra"
)

var (
	count           uint
	socketActivated bool
	cmdPort         = &cobra.Command{
		Use:   "port [command]",
		Short: "Manage ports",
	}
	cmdAddPort = &cobra.Command{
		Use:     "add NAME PROTOCOL PORT",
		Short:   "Add a port",
		Long:    "Updates the ACI to contain a port with the given name, protocol, and port. If the port already exists, its values will be changed.",
		Example: "acbuild port add https tcp 443 --socket-activated",
		Run:     runWrapper(runAddPort),
	}
	cmdRmPort = &cobra.Command{
		Use:     "remove NAME",
		Aliases: []string{"rm"},
		Short:   "Remove a port",
		Long:    "Updates the ports in the ACI's manifest to include a port with the given name and value",
		Example: "acbuild port remove https",
		Run:     runWrapper(runRmPort),
	}
)

func init() {
	cmdAcbuild.AddCommand(cmdPort)
	cmdPort.AddCommand(cmdAddPort)
	cmdPort.AddCommand(cmdRmPort)

	cmdAddPort.Flags().UintVar(&count, "count", 1, "Specifies a range of ports, going from PORT to PORT + count - 1")
	cmdAddPort.Flags().BoolVar(&socketActivated, "socket-activated", false, "Set the app to be socket activated on this/these port/ports")
}

func runAddPort(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 3 {
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.008908685968819599, 'mean_word_length': 3.5620767494356658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6668730', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1263, 'n_words': 475}