<commit_before>package main

import (
	"fmt"
	"os"

	"github.com/choueric/cmdmux"
)

type Options struct {
	name string
}

func rootHandler(args []string, data interface{}) (int, error) {
	fmt.Println("Usage: build [uboot|kernel]")
	fmt.Println("       build kernel [image|dtb]")
	fmt.Println("       completion")
	return 0, nil
}

func buildHandler(args []string, data interface{}) (int, error) {
	opt := data.(*Options)
	fmt.Printf("invoke 'build' of %s\n", opt.name)
	return 1, nil
}

func buildKernelHandler(args []string, data interface{}) (int, error) {
	fmt.Printf("invoke 'build kernel', args = %v\n", args)
	return 2, nil
}

func completionHandler(args []string, data interface{}) (int, error) {
	cmdmux.GenerateCompletion("example", os.Stdout)
	return 2, nil
}

func main() {
	opt := &Options{name: "arm"}

	cmdmux.HandleFunc("/", rootHandler)
	cmdmux.HandleFunc("/build/uboot", buildKernelHandler)
	cmdmux.HandleFunc("/build/kernel/image", buildKernelHandler)
	cmdmux.HandleFunc("/build/kernel/dtb", buildKernelHandler)
	cmdmux.HandleFunc("/build", buildHandler)
	cmdmux.HandleFunc("/completion", completionHandler)

	fmt.Println(cmdmux.String())
<commit_msg>update example<commit_after>package main

import (
	"fmt"
	"os"

	"github.com/choueric/cmdmux"
)

type Options struct {
	name string
}

func rootHandler(args []string, data interface{}) (int, error) {
	fmt.Printf("Usage:\n%s\n", cmdmux.String())
	return 0, nil
}

func buildHandler(args []string, data interface{}) (int, error) {
	opt := data.(*Options)
	fmt.Printf("invoke 'build' of %s\n", opt.name)
	return 1, nil
}

func buildKernelHandler(args []string, data interface{}) (int, error) {
	fmt.Printf("invoke 'build kernel', args = %v\n", args)
	return 2, nil
}

func completionHandler(args []string, data interface{}) (int, error) {
	cmdmux.GenerateCompletion("example", os.Stdout)
	return 2, nil
}

func optionOHandler(args []string, data interface{}) (int, error) {
	fmt.Printf("invoke 'option -o', args = %v\n", args)
	return 3, nil
}

func optionPHandler(args []string, data interface{}) (int, error) {
	fmt.Printf("invoke 'option -p', args = %v\n", args)
	return 3, nil
}

func main() {
	opt := &Options{name: "arm"}

	cmdmux.HandleFunc("/", rootHandler)
	cmdmux.HandleFunc("/build/kernel/image", buildKernelHandler)
	cmdmux.HandleFunc("/build/kernel/dtb", buildKernelHandler)
	cmdmux.HandleFunc("/build", buildHandler)
	cmdmux.HandleFunc("/option/-o", optionOHandler)
	cmdmux.HandleFunc("/option/-p", optionPHandler)
	cmdmux.HandleFunc("/completion", completionHandler)

{'fraction_non_alphanumeric': 0.16745098039215686, 'fraction_numerical': 0.00392156862745098, 'mean_word_length': 5.237163814180929, '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': '6294121', 'n_tokens_mistral': 883, 'n_tokens_neox': 868, 'n_words': 213}