Coder Social home page Coder Social logo

goproperties's Introduction

Goproperties Build Status

Package implements read operations of .properties source.

Documentation

The Goproperties API reference is available on GoDoc.

Installation

Install Goproperties using the go get command:

go get -u github.com/dmotylev/goproperties

Usage

Example:

package main

import "github.com/dmotylev/goproperties"

func main() {
	p, _ := properties.Load("credentials")
	username := p.String("username","demo")
	password := p.String("password","demo")

	// ... use given credentials

	_, _ = username, password
}

Look at properties_test.go for more usage hints.

License

For the license see LICENSE.

goproperties's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goproperties's Issues

Key containing colon is a valid use case for properties files?

While experimenting with Goproperties to parse a VMware VMX file, I found out it does not parse keys that contain colons such as: ide1:0.devicetype="cdrom-image"

Is supporting colons in the key within the scope of this package? if so, I would be happy to provide a patch.

Line buffer too small

I have properties files that fail to load because the value length exceeds the hard coded 1024. See lines 309 and 310.

Please make this configurable (or use slices?).

My workaround is to modify the lines to:

n.buffer = make([]byte, 2048)
n.lineBuffer = make([]byte, 2048) 

Writing properties

Any chance you'll be working on Write function(s) for this project in the near future?

Filepath as value of a property in windows platform

Property which sets the value of a filepath in windows platform would be like :

custom_path = C:\Users\abc

But value of this property obtained using Load method would be like C:Usersabc as it escapes the slashes.

Escaping slashes in the value of the property works. But this is not standard way of setting path in a properties file. (windows)

custom_path = C:\\Users\\abc

Is there a workaround for it? Any comments?

Line buffer too small

I have properties files that fail to load because the value length exceeds the hard coded 1024. See lines 309 and 310.

Please make this configurable (or use slices?).

My workaround is to modify the lines to:

n.buffer = make([]byte, 2048)
n.lineBuffer = make([]byte, 2048) 

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.