Supporting your devops by shortening your strings using common abbreviations and clever guesswork

abbreviate

Shorten your strings using common abbreviations.

ko-fi

codecov godoc report card

GitHub watchers GitHub stars Twitter URL

Supported by Tidelift

Motivation

This tool comes out of a frustration of the name of resources (in my specific case, AWS stack names) being too long. Wouldn't it be nice if we could have a tool that would be able to suggest shorter alternatives if your original name is too long.

Installation

go get github.com/dnnrly/abbreviate
make build

Usage

This tool will attempt to shorten the string provided using common abbreviations
specified by language and 'set'. Common prefixes and suffixes are also abbreviated.
Word boundaries will be detected using title case and non-letters.

Hosted on Github - https://github.com/dnnrly/abbreviate

If you spot a bug, feel free to raise an issue or fix it and make a pull
request. We're really interested to see more abbreviations added or corrected.

Usage:
  abbreviate [action] [flags]
  abbreviate [command]

Available Commands:
  camel       Abbreviate a string and convert it to camel case
  help        Help about any command
  original    Abbreviate the string using the original word boundary separators
  pascal      Abbreviate a string and convert it to pascal case
  print       Print abbreviations in this set
  snake       Abbreviate a string and convert it to snake case
  kebab       Abbreviate a string and convert it to kebab case
  separated   Abbreviate a string and convert it with separator passed between words and abbreviations

Flags:
  -c, --custom string     Custom abbreviation set
      --from-front        Shorten from the front
  -h, --help              help for abbreviate
  -l, --language string   Language to select (default "en-us")
      --list              List all abbreviate sets by language
  -m, --max int           Maximum length of string, keep on abbreviating while the string is longer than this limit
  -n, --newline           Add newline to the end of the string (default true)
  -s, --set string        Abbreviation set (default "common")

Use "abbreviate [command] --help" for more information about a command.

Examples:

$ abbreviate original strategy-limited
stg-ltd

$ abbreviate original prestrategy-limitedment
prstg-ltdmnt

$ abbreviate original --max 11 strategy-limited
strategy-ltd

$ abbreviate original --max 11 --from-front strategy-limited
stg-limited

$ abbreviate camel --max 99 strategy-limited
strategyLimited

$ abbreviate kebab StrategyLimited
stg-ltd

$ abbreviate separated StrategyLimited --separator +
stg+ltd

$ abbreviate separated StrategyLimited
stgltd

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code.

Contributing

Pull requests are welcome. See the contributing guide for more details.

Please make sure to update tests as appropriate.

github.com/dnnrly/abbreviate for enterprise

Available as part of the Tidelift Subscription

The maintainers of github.com/dnnrly/abbreviate and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

License

Apache 2

Comments
  • Add kebab case

    Add kebab case

    Description

    Adding support for kebab case

    Fixes #16

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [x] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x] Running existing tests
    • [x] Created new tests

    Checklist:

    • [ ] My code has been linted (make lint)
    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] I have added tests that prove my fix is effective or that my feature works
    • [ ] New and existing unit tests pass locally with my changes
    • [ ] I have rebased my branch to include the latest changes from master
  • Feature/custom data

    Feature/custom data

    Description

    Adds plumbing for custom abbreviation data and the ability to print abbreviation sets

    Type of change

    • [x] New feature (non-breaking change which adds functionality)
    • [x] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x] Running existing tests
    • [x] Created new tests

    Checklist:

    • [x] My code has been linted (make lint)
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] I have made corresponding changes to the documentation
    • [x] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [x] I have rebased my branch to include the latest changes from master
  • Handle common prefixes/suffixes (when predefined word does not exist)

    Handle common prefixes/suffixes (when predefined word does not exist)

    Is your feature request related to a problem? Please describe. Related to #13

    Describe the solution you'd like Add list of common prefixes and suffixes and their abbreviations (e.g. -ible -> bl) When predefined word does not exist, attempt to remove common prefix or suffix (e.g. in-access-ible -> access-ible) Look up remaining word again Repeat prefix/suffix removal as many times as necessary (e.g. access-ible -> access) Concatenate prefix abbreviation, word abbreviation, and suffix abbreviation (e.g. in-access-ible -> in-acc-bl)

    cc @FungusHumungus

  • Add prefix and suffix truncation to lookup strategy

    Add prefix and suffix truncation to lookup strategy

    Description

    Relates to #21 @FungusHumungus

    • [x] New feature (non-breaking change which adds functionality)
    • [x] This change requires a documentation update

    How Has This Been Tested?

    • [x] Running existing tests
    • [x] Created new tests

    Checklist:

    • [ ] My code has been linted (make lint)
    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [x] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [x] I have rebased my branch to include the latest changes from master
  • Setting up a workflow for every pull request

    Setting up a workflow for every pull request

    Is your feature request related to a problem? Please describe. Creating a pull request does not check whether the change has broken current working test cases. Although it is encouraged to run all the tests before someone submits a PR but being double sure is good.

    Describe the solution you'd like Add a github workflow that will trigger all the tests to run when someone raises a PR.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

  • Shorten from the front option (--from-front)

    Shorten from the front option (--from-front)

    Description

    Create --from-front option for anyone that want to shorten from the front.

    Fixes #14

    Type of change

    Please delete options that are not relevant.

    • [x] New feature (non-breaking change which adds functionality)
    • [x] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x] Running existing tests
    • [x] Created new tests

    Checklist:

    • [x] My code has been linted (make lint)
    • [x] I have performed a self-review of my own code
    • [x] I have made corresponding changes to the documentation
    • [x] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [x] I have rebased my branch to include the latest changes from master
  • Shorten from the front

    Shorten from the front

    Is your feature request related to a problem? Please describe. At the moment, the algorithm used starts from the last 'word' in the string and works backwards. This makes an assumption about how the string should be shortened that may not work for everyone. A good option might be to shorten from the front instead.

    Describe the solution you'd like

    $ abbreviate --length 15 strategy-limited
    strategy-ltd
    $ abbreviate --from-front --length 15 strategy-limited
    stg-limited
    
  • Upgrade CodeSee workflow to version 2

    Upgrade CodeSee workflow to version 2

    CodeSee is a code visibility platform.

    This change updates the CodeSee workflow file to the latest version for security, maintenance, and support improvements (see changelog below).

    That workflow file:

    • runs CodeSee's code analysis on every PR push and merge
    • uploads that analysis to CodeSee.
    • It does not transmit your code.

    The code analysis is used to generate maps and insights about this codebase.

    CodeSee workflow changelog:

    • Improved security: Updates permission to be read-only.
    • Improved future maintenance: Replaces the body of the workflow with a single github action: codesee-action. This makes it significantly easier for CodeSee to introduce future improvements and fixes without requiring another PR like this.
    • Improved Python support: The action now properly supports Python 3.11, and will continue to support new Python versions as they are released.
  • add more common-en-us abbreviations

    add more common-en-us abbreviations

    Description

    Contributes to #4 by adding some additional abbreviations to the common-en-us set.

    Type of change

    • [x] New feature (non-breaking change which adds functionality)

    How Has This Been Tested?

    • [x] Running existing tests
  • Add abbreviations: impl, if, ms

    Add abbreviations: impl, if, ms

    Description

    Added 4 abbreviations to data/common-us-en.go:

    1. implementation --> impl
    2. interface --> if
    3. millisecond --> ms
    4. milliseconds --> ms

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] This change requires a documentation update

    How Has This Been Tested?

    I compiled the program and ran it in the command-line:

    $ abbreviate original service-implementation
    svc-impl
    $ abbreviate original service-interface
    svc-if
    $ abbreviate original service-millisecond
    svc-ms
    $ abbreviate original service-milliseconds
    svc-ms
    

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x] Running existing tests
    • [ ] Created new tests

    Checklist:

    • [ ] My code has been linted (make lint)
    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [x] I have rebased my branch to include the latest changes from master
  • Updated LICENSE.md Corrected And Synced Terminology.

    Updated LICENSE.md Corrected And Synced Terminology.

    Description

    Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [x] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [ ] Running existing tests
    • [ ] Created new tests

    Checklist:

    • [ ] My code has been linted (make lint)
    • [ ] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [ ] I have made corresponding changes to the documentation
    • [ ] I have added tests that prove my fix is effective or that my feature works
    • [ ] New and existing unit tests pass locally with my changes
    • [ ] I have rebased my branch to include the latest changes from master
  • Remove functional words using a list of stopwords

    Remove functional words using a list of stopwords

    Is your feature request related to a problem? Please describe. The English language has a lot of short connector words which have a grammatical function but don't necessarily provide meaning. Thus they can be omitted when creating abbreviations.

    Describe the solution you'd like A simple solution would be to save a list of stopwords and to have a flag that the user could use to remove them.

    Here is an example: $ abbreviate snake "The strategy of limited science" --stopwords tstg_ltd_sci

    versus the current behavior (so without the flag): $ abbreviate snake "The strategy of limited science" --stopwords the_stg_of_ltd_sci

    Additional context Initially we could curate our own list of stopwords. Eventually we could use this as a possible source: https://github.com/bbalet/stopwords

  • Migrate to GoDog acceptance tests

    Migrate to GoDog acceptance tests

    Is your feature request related to a problem? Please describe.

    At the moment, we have to include non-go dependencies to run acceptance tests. This is bash based and tricky to get right. We could achieve just as much with godog, without having to switch to another language. And go has more testing features/libraries available.

    Describe the solution you'd like BATS acceptance tests replaced with Godog ones.

  • 1.Support for a new flag --strategy to remove vowels from input if no…

    1.Support for a new flag --strategy to remove vowels from input if no…

    … match is found. 2. Added new tests for the modified Match function.

    Description

    This change introduces a new flag called --strategy(-r) to attempt to remove vowels from the input string if no match is found. Introducing a flag instead of a command was easier to implement with the current structure , also it provides more flexibility to add new strategies in the future

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x] Running existing tests
    • [x] Created new tests

    Checklist:

    • [ ] My code has been linted (make lint)
    • [x] I have performed a self-review of my own code
    • [ ] I have commented my code, particularly in hard-to-understand areas
    • [x] I have made corresponding changes to the documentation
    • [x] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [x] I have rebased my branch to include the latest changes from master
  • Attempt to guess an abbreviation when a predefined one doesn't exist

    Attempt to guess an abbreviation when a predefined one doesn't exist

    Is your feature request related to a problem? Please describe. At the moment, there is a defined list of abbreviations that are looked up. Where an abbreviation isn't present, it just won't be abbreviated.

    Describe the solution you'd like It would be good if the tool could attempt to shorten words taht it doesn't already know about.

    A couple of different strategies we could explore:

    • Match only parts of words
    • Remove all vowels

    Additional context How would this work with other languages?

  • New abbreviations

    New abbreviations

    Is your feature request related to a problem? Please describe. The current list of abbreviations is OK but l feel a little lacking.

    Describe the solution you'd like

    • More abbreviations
    • Abbreviations in other languages
k6 is a modern load testing tool for developers and testers in the DevOps era.
k6 is a modern load testing tool for developers and testers in the DevOps era.

k6 is a modern load testing tool, building on our years of experience in the load and performance testing industry. It provides a clean, approachable scripting API, local and cloud execution, and flexible configuration.

Jan 8, 2023
sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC), and Everything as Code. So it is a tool for DevOps.

sail 中文文档 sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC),a

Dec 16, 2021
A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s.
A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s.

A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s. OAM operator scaffolds all of the code required to create resources across various cloud provides, which includes both K8s and Non-K8s resources

Nov 30, 2021
Fluxcdproj - The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers
Fluxcdproj -  The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers

Fluxcdproj - The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers

Feb 1, 2022
This is a cloud-native application that focuses on the DevOps area.

Get started Install KubeSphere via kk (or other ways). This is an optional step, basically we need a Kubernetes Cluster and the front-end of DevOps. I

Jan 5, 2023
Power-ups for the daily DevOps life

DevOps Loop Power-Ups Requirements Connected Kubernetes cluster. Some features need support for LoadBalancer services Permission to list, create and d

Nov 3, 2022
Zeus - A Devops Automation Tool

With this tool we are trying generalize and minimize devops reperating task while trying to encourage shared responsibility model acorss devloper teams.

May 31, 2022
DevOps With Kubernetes exercise

todo-project [https://github.com/pasiol/todo-project/tree/1.05] Exercise 1.06 pasiol@lab:~$ k3d cluster delete INFO[0000] Deleting cluster 'k3s-defaul

Dec 8, 2021
Kubernetes operator for the Azure DevOps pipe-line agents

adoagent-operator Kubernetes operator for the Azure DevOps pipe-line agents init.sh #!/bin/bash # docker and github repo username export USERNAME='ba

Nov 11, 2021
This is a cloud-native application that focuses on the DevOps area.

KubeSphere DevOps integrates popular CI/CD tools, provides CI/CD Pipelines based on Jenkins, offers automation toolkits including Binary-to-Image (B2I

Jan 5, 2023
Kubernetes operator for the Azure DevOps self-hosted pipe-line agent.

Kubernetes operator for the Azure DevOps self-hosted pipe-line agent. The operator adds an extra layer of configuration on top of the default images like: proxy settings, pool settings and auth keys.

Sep 1, 2022
Repositório base p/ tema12 da trilha de DevOps.

tema12--Jenkins Informações Repositório base: https://github.com/brazdore/ilegra-devops-tema12.git Requisitos Jenkins Docker Packer JDK 11 ou maior Pr

Dec 21, 2021
DevOps Roadmap 2022

Want to learn DevOps the right way in 2022 ? You have come to the right place I have created the complete DevOps roadmap that anyone can follow and be

Dec 28, 2022
Git-based DevOps PaaS: Project, Pipeline, Kubernetes, ServiceMesh, MutilCloud

gitctl 一体化 DevOps 平台 从代码到应用的一体化编排,应用全生命周期管理,多云托管。 gitctl 会有哪些功能? git 代码托管 projec

Oct 24, 2022
Isaac Gazimbe - DevOps Golang Tools

Isaac Gazimbe - DevOps Golang Tools git.io/go-tools DevOps Golang Tools All programs have --help to list the available options. See Also: DevOps Bash

Feb 10, 2022
Kubernetes Operator supporting NETCONF RPCs and Notifications.
 Kubernetes Operator supporting NETCONF RPCs and Notifications.

❗ Red Hat does not provide commercial support for the content of these repos #########################################################################

Oct 27, 2022
k6 extension supporting avro textual and binary representations

xk6-avro This extension wraps the goavro library into a k6 extension. You can build the extension using: xk6 build --with github.com/xvzf/xk6-avro Exa

Dec 8, 2021
Graphic library supporting various displays

eve Package eve provides interface to FTDI/BRTCHIP Embedded Video Engine display controllers (FT80x, FT81x, BT1x). font Package font provides a simple

Dec 26, 2022
Common Expression Language -- specification and binary representation

The Common Expression Language (CEL) implements common semantics for expression evaluation, enabling different applications to more easily interoperate.

Jan 8, 2023