Coder Social home page Coder Social logo

gohead's Introduction

goHead

goによるheadコマンド実装です。

以下仕様を満たす

  • 引数で渡されたファイルの先頭の最大N行をそのまま出力する
  • Nはデフォルトでは10
  • オプション -n でNを指定できる

追加機能

  • オプション -c で出力するバイト数を指定可能
  • 複数ファイル指定可能にする。その場合==> {ファイル名} <==でファイル内容を区切る

installation

$ go get github.com/yusukemisa/goHead

実行例

$goHead -n 5 v.txt hoge.txt piyo.txt 
==> v.txt <==
♪バーチャルのじゃロリ狐娘 YouTuber おじさん

(タイガー! ファイヤー! サイバー! ファイバー! ダイバー! バイバー! のーじゃー!)
(タイガー! ファイヤー! サイバー! ファイバー! ダイバー! バイバー! のーじゃー!)


==> hoge.txt <==
1  キズナアイ
2  電脳少女シロ
3  ミライアカリ
4  バーチャルのじゃロリ狐娘おじさん
5  輝夜月

==> piyo.txt <==
A
B
C
D
E
$

test(可能であれば)

  • 主要な処理をmainから追い出してテストコード書けるようにしたい
  • headコマンドの結果と一致するテストを書く

gohead's People

Contributors

yusukemisa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.