<commit_before>/* Copyright (c) 2015, <NAME> <<EMAIL>> */
/* See LICENSE for licensing information */

package main

import (
	"encoding/hex"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/mvdan/fdroidcl"
)

var cmdList = &Command{
	Name:  "list",
	Short: "List all available apps",
}

func init() {
	cmdList.Run = runList
}

func runList(args []string) {
	index := mustLoadIndex()
	printApps(index.Apps)
}

func mustLoadIndex() *fdroidcl.Index {
	repoPubkey := ""
	p := indexPath(repoName)
	f, err := os.Open(p)
	if err != nil {
		log.Fatalf("Could not open index file: %v", err)
	}
	stat, err := f.Stat()
	if err != nil {
		log.Fatalf("Could not stat index file: %v", err)
	}
	pubkey, err := hex.DecodeString(repoPubkey)
	if err != nil {
		log.Fatalf("Could not decode public key: %v", err)
	}
	index, err := fdroidcl.LoadIndexJar(f, stat.Size(), pubkey)
	if err != nil {
		log.Fatalf("Could not load index: %v", err)
	}
	return index
}<commit_msg>Comment out unused pubkey code<commit_after>/* Copyright (c) 2015, <NAME> <<EMAIL>> */
/* See LICENSE for licensing information */

package main

import (
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/mvdan/fdroidcl"
)

var cmdList = &Command{
	Name:  "list",
	Short: "List all available apps",
}

func init() {
	cmdList.Run = runList
}

func runList(args []string) {
	index := mustLoadIndex()
	printApps(index.Apps)
}

func mustLoadIndex() *fdroidcl.Index {
	p := indexPath(repoName)
	f, err := os.Open(p)
	if err != nil {
		log.Fatalf("Could not open index file: %v", err)
	}
	stat, err := f.Stat()
	if err != nil {
		log.Fatalf("Could not stat index file: %v", err)
	}
	//pubkey, err := hex.DecodeString(repoPubkey)
	//if err != nil {
		//log.Fatalf("Could not decode public key: %v", err)
	//}
	index, err := fdroidcl.LoadIndexJar(f, stat.Size(), nil)
	if err != nil {
		log.Fatalf("Could not load index: %v", err)
	}
	return index
}
{'fraction_non_alphanumeric': 0.17038216560509553, 'fraction_numerical': 0.004246284501061571, 'mean_word_length': 3.736180904522613, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '616998', 'n_tokens_mistral': 749, 'n_tokens_neox': 735, 'n_words': 204}