<commit_before>package main

import kingpin "gopkg.in/alecthomas/kingpin.v2"

var (
	_ = kingpin.Command("version", "display version info")

	srv     = kingpin.Command("service", "manage service settings")
	initSrv = srv.Command("init", "initialise a service")
	set     = srv.Command("set", "set a value")
	unset   = srv.Command("unset", "unset a value")
	use     = srv.Command("use", "switch service")
	lstSrv  = srv.Command("list", "list all stored services")
	config  = srv.Command("config", "show and alter service configs")
	action  = srv.Command("alias", "set an action")

	get    = kingpin.Command("get", "Perform a GET request")
	post   = kingpin.Command("post", "Perform a POST request")
	put    = kingpin.Command("put", "Perform a PUT request")
	delete = kingpin.Command("delete", "Perform a DELETE request")

	perform = kingpin.Command("perform", "Perform a predifined action")
)

func init() {
	requestMethod(get)
	requestDataMethod(post)
	requestDataMethod(put)
	requestMethod(delete)
}

// requestFlags apply to all the basic request types
func requestFlags(cmd *kingpin.CmdClause) {
	cmd.Flag("service", "the service to use").StringVar(&request.Service)
	cmd.Flag("no-headers", "ignore stored service headers").BoolVar(&request.NoHeaders)
	cmd.Flag("no-queries", "ignore stored service queries").BoolVar(&request.NoQueries)

	settings = NewSettings()
	settings.Flags(cmd)

	cmd.Flag("filter", "pull parts out of the returned json. use [#] to access specific elements from an array, use the key name to access the key. eg. '[0].id', 'id', and 'things.[1]'").StringVar(&filter)

}

// requestMethod applies to all requests that don't accept a body
func requestMethod(cmd *kingpin.CmdClause) {
	cmd.Arg("path", "url to perform request on").Required().StringVar(&request.Path)
	requestFlags(cmd)
}

// requestDataMethod applies to all request that accept a body
func requestDataMethod(cmd *kingpin.CmdClause) {
	cmd.Arg("path", "url to perform request on").Required().StringVar(&request.Path)
	cmd.Arg("data", "data to send in the request").Required().StringVar(&request.Data)
<commit_msg>Allow passing flags to an aliased command<commit_after>package main

import kingpin "gopkg.in/alecthomas/kingpin.v2"

var (
	_ = kingpin.Command("version", "display version info")

	srv     = kingpin.Command("service", "manage service settings")
	initSrv = srv.Command("init", "initialise a service")
	set     = srv.Command("set", "set a value")
	unset   = srv.Command("unset", "unset a value")
	use     = srv.Command("use", "switch service")
	lstSrv  = srv.Command("list", "list all stored services")
	config  = srv.Command("config", "show and alter service configs")
	action  = srv.Command("alias", "set an action")

	get    = kingpin.Command("get", "Perform a GET request")
	post   = kingpin.Command("post", "Perform a POST request")
	put    = kingpin.Command("put", "Perform a PUT request")
	delete = kingpin.Command("delete", "Perform a DELETE request")

	perform = kingpin.Command("perform", "Perform a predifined action")
)

func init() {
	requestMethod(get)
	requestDataMethod(post)
	requestDataMethod(put)
	requestMethod(delete)

	perform.Arg("data", "data to send in the request").
		StringVar(&request.Data)
	requestFlags(perform)
}

// requestFlags apply to all the basic request types
func requestFlags(cmd *kingpin.CmdClause) {
	cmd.Flag("service", "the service to use").StringVar(&request.Service)
	cmd.Flag("no-headers", "ignore stored service headers").BoolVar(&request.NoHeaders)
	cmd.Flag("no-queries", "ignore stored service queries").BoolVar(&request.NoQueries)

	settings = NewSettings()
	settings.Flags(cmd)

	cmd.Flag("filter", "pull parts out of the returned json. use [#] to access specific elements from an array, use the key name to access the key. eg. '[0].id', 'id', and 'things.[1]'").StringVar(&filter)

}

// requestMethod applies to all requests that don't accept a body
func requestMethod(cmd *kingpin.CmdClause) {
	cmd.Arg("path", "url to perform request on").Required().StringVar(&request.Path)
	requestFlags(cmd)
}

// requestDataMethod applies to all request that accept a body
func requestDataMethod(cmd *kingpin.CmdClause) {
	cmd.Arg("path", "url to perform request on").Required().StringVar(&request.Path)
	cmd.Arg("data", "data to send in the request").Required().StringVar(&request.Data)

{'fraction_non_alphanumeric': 0.1433518005540166, 'fraction_numerical': 0.0013850415512465374, 'mean_word_length': 5.102816901408451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1395236', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1349, 'n_words': 397}