<commit_before><commit_msg>cmds/exp: add fbsplash command<commit_after>// Copyright 2019-2019 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// see the example at https://golang.org/pkg/image/png/#Decode

package main

import (
	"encoding/base64"
	"flag"
	"fmt"
	"image"
	"image/png"
	"io"
	"os"
	"strings"

	"github.com/u-root/u-root/pkg/fb"
)

const gopher = `<KEY>`

// gopherPNG creates an io.Reader by decoding the base64 encoded image data string in the gopher constant.
func gopherPNG() io.Reader { return base64.NewDecoder(base64.StdEncoding, strings.NewReader(gopher)) }

var pngFile string

func init() {
	flag.StringVar(&pngFile, "file", "", "path to a PNG file")
}

func main() {
	flag.Parse()
	var img image.Image
	var err error
	// If no file is provided, draw the gopher as a fallback :)
	if len(pngFile) > 0 {
		imageFile, _ := os.Open(pngFile)
		defer imageFile.Close()
		img, err = png.Decode(imageFile)
	} else {
		imageFile := gopherPNG()
		img, err = png.Decode(imageFile)
	}
	if err != nil {
		fmt.Println(err)
	}
	if err = fb.DrawImageAt(img, 0, 0); err != nil {
		fmt.Println(err)
	}
}
{'fraction_non_alphanumeric': 0.13421706710853357, 'fraction_numerical': 0.015741507870753936, 'mean_word_length': 3.646153846153846, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '6854733', 'n_tokens_mistral': 469, 'n_tokens_neox': 437, 'n_words': 133}