Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: deploytool/cmd/title.go

Issue 2182213002: deploytool: Add README.md, migrate docs to it. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Rename to "luci_deploy" Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « deploytool/cmd/staging.go ('k') | deploytool/cmd/tools.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: deploytool/cmd/title.go
diff --git a/deploytool/cmd/title.go b/deploytool/cmd/title.go
deleted file mode 100644
index f2e77dbd5ce90396a119cae52bade88d0b01dcac..0000000000000000000000000000000000000000
--- a/deploytool/cmd/title.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 The LUCI Authors. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package main
-
-import (
- "path/filepath"
- "unicode"
-
- "github.com/luci/luci-go/common/errors"
-)
-
-type title string
-
-func (t title) validate() error {
- if len(t) == 0 {
- return errors.New("cannot be empty")
- }
-
- idx := 0
- for _, r := range t {
- if !(unicode.IsLetter(r) || unicode.IsNumber(r) || r == '-') {
- return errors.Reason("character at %(pos)d (%(char)c) is not permitted in a title").
- D("pos", idx).D("char", r).Err()
- }
- idx++
- }
- return nil
-}
-
-// titleFromConfigPath returns the title of a configuration item identified by
-// the specified configuration file.
-//
-// If the file was not a valid config path, or the title was not valid, an error
-// will be returned.
-func titleFromConfigPath(path string) (title, error) {
- path = filepath.Base(path)
- if filepath.Ext(path) == configExt {
- t := title(path[:len(path)-len(configExt)])
- if err := t.validate(); err != nil {
- return "", err
- }
- return t, nil
- }
- return "", errors.Reason("missing config extension [" + configExt + "]").Err()
-}
« no previous file with comments | « deploytool/cmd/staging.go ('k') | deploytool/cmd/tools.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698